diff --git a/ant/.classpath b/ant/.classpath new file mode 100644 index 00000000..bc5aeac5 --- /dev/null +++ b/ant/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/basics/tags/0.6.4/ant/.project b/ant/.project similarity index 100% rename from basics/tags/0.6.4/ant/.project rename to ant/.project diff --git a/basics/trunk/ant/pom.xml b/ant/pom.xml similarity index 100% rename from basics/trunk/ant/pom.xml rename to ant/pom.xml diff --git a/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java new file mode 100644 index 00000000..e332bcdb --- /dev/null +++ b/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java @@ -0,0 +1,34 @@ +package org.jvnet.jaxb2_commons.xjc; + +import java.io.File; +import java.lang.reflect.Field; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.types.Path; + +public class XJC2Task extends com.sun.tools.xjc.XJC2Task { + + @Override + public void execute() throws BuildException { + + hack(); + super.execute(); + } + + protected void hack() { + try { + final Field declaredField = getClass().getSuperclass() + .getDeclaredField("classpath"); + declaredField.setAccessible(true); + final Path path = (Path) declaredField.get(this); + if (path != null) { + for (String pathElement : path.list()) { + options.classpaths.add(new File(pathElement).toURI() + .toURL()); + } + } + } catch (Exception ex) { + throw new BuildException(ex); + } + } +} diff --git a/basic/.classpath b/basic/.classpath new file mode 100644 index 00000000..ecf83840 --- /dev/null +++ b/basic/.classpath @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/basics/tags/0.6.4/basic/.project b/basic/.project similarity index 100% rename from basics/tags/0.6.4/basic/.project rename to basic/.project diff --git a/basics/trunk/basic/pom.xml b/basic/pom.xml similarity index 100% rename from basics/trunk/basic/pom.xml rename to basic/pom.xml diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java new file mode 100644 index 00000000..a9860669 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java @@ -0,0 +1,15 @@ +package org.jvnet.jaxb2_commons.plugin; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; + + public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "generated"); + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java new file mode 100644 index 00000000..3a0ee95a --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java @@ -0,0 +1,80 @@ +package org.jvnet.jaxb2_commons.plugin; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.util.CustomizationUtils; + +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.CEnumLeafInfo; +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.EnumOutline; +import com.sun.tools.xjc.outline.FieldOutline; + +public class CustomizedIgnoring implements Ignoring { + + private final QName[] ignoredCustomizationElementNames; + + public CustomizedIgnoring(QName... names) { + this.ignoredCustomizationElementNames = names; + } + + public QName[] getIgnoredCustomizationElementNames() { + return ignoredCustomizationElementNames; + } + + public boolean isIgnored(ClassOutline classOutline) { + for (QName name : getIgnoredCustomizationElementNames()) { + if (CustomizationUtils.containsCustomization(classOutline, name)) { + return true; + } + } + return false; + } + + public boolean isIgnored(EnumOutline enumOutline) { + for (QName name : getIgnoredCustomizationElementNames()) { + if (CustomizationUtils.containsCustomization(enumOutline, name)) { + return true; + } + } + return false; + } + + public boolean isIgnored(FieldOutline fieldOutline) { + for (QName name : getIgnoredCustomizationElementNames()) { + if (CustomizationUtils.containsCustomization(fieldOutline, name)) { + return true; + } + } + return false; + } + + public boolean isIgnored(CClassInfo classInfo) { + for (QName name : getIgnoredCustomizationElementNames()) { + if (CustomizationUtils.containsCustomization(classInfo, name)) { + return true; + } + } + return false; + } + + public boolean isIgnored(CEnumLeafInfo enumLeafInfo) { + for (QName name : getIgnoredCustomizationElementNames()) { + if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) { + return true; + } + } + return false; + } + + public boolean isIgnored(CPropertyInfo propertyInfo) { + for (QName name : getIgnoredCustomizationElementNames()) { + if (CustomizationUtils.containsCustomization(propertyInfo, name)) { + return true; + } + } + return false; + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java new file mode 100644 index 00000000..d5ae14f6 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java @@ -0,0 +1,24 @@ +package org.jvnet.jaxb2_commons.plugin; + +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.CEnumLeafInfo; +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.EnumOutline; +import com.sun.tools.xjc.outline.FieldOutline; + +public interface Ignoring { + + public boolean isIgnored(ClassOutline classOutline); + + public boolean isIgnored(EnumOutline enumOutline); + + public boolean isIgnored(FieldOutline fieldOutline); + + public boolean isIgnored(CClassInfo classInfo); + + public boolean isIgnored(CEnumLeafInfo enumLeafInfo); + + public boolean isIgnored(CPropertyInfo propertyInfo); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java new file mode 100644 index 00000000..2754259e --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java @@ -0,0 +1,141 @@ +package org.jvnet.jaxb2_commons.plugin.autoinheritance; + +import java.util.LinkedList; +import java.util.List; + +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.model.CElementInfo; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.ElementOutline; +import com.sun.tools.xjc.outline.Outline; + +public class AutoInheritancePlugin extends AbstractParameterizablePlugin { + + private String xmlRootElementsExtend = null; + private List xmlRootElementsImplement = new LinkedList(); + + private String xmlTypesExtend = null; + private List xmlTypesImplement = new LinkedList(); + + private List jaxbElementsImplement = new LinkedList(); + + public String getXmlRootElementsExtend() { + return xmlRootElementsExtend; + } + + public void setXmlRootElementsExtend(String globalElementsExtend) { + this.xmlRootElementsExtend = globalElementsExtend; + } + + public String getXmlRootElementsImplement() { + return xmlRootElementsImplement.toString(); + } + + public void setXmlRootElementsImplement(String xmlRootElementsImplement) { + this.xmlRootElementsImplement.add(xmlRootElementsImplement); + } + + public String getXmlTypesExtend() { + return xmlTypesExtend; + } + + public void setXmlTypesExtend(String globalComplexTypesExtend) { + this.xmlTypesExtend = globalComplexTypesExtend; + } + + public String getXmlTypesImplement() { + return xmlTypesImplement.toString(); + } + + public void setXmlTypesImplement(String xmlTypesImplement) { + this.xmlTypesImplement.add(xmlTypesImplement); + } + + public String getJaxbElementsImplement() { + return jaxbElementsImplement.toString(); + } + + public void setJaxbElementsImplement(String jaxbElementsImplement) { + this.jaxbElementsImplement.add(jaxbElementsImplement); + } + + @Override + public String getOptionName() { + return "XautoInheritance"; + } + + @Override + public String getUsage() { + return "TBD"; + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + for (final ClassOutline classOutline : outline.getClasses()) { + if (classOutline.target.getElementName() != null) { + processGlobalElement(classOutline); + } else { + processGlobalComplexType(classOutline); + } + } + for (final CElementInfo elementInfo : outline.getModel() + .getAllElements()) { + final ElementOutline elementOutline = outline + .getElement(elementInfo); + if (elementOutline != null) { + processGlobalJAXBElement(elementOutline); + } + } + return true; + } + + protected void processGlobalElement(ClassOutline classOutline) { + + generateExtends(classOutline.implClass, xmlRootElementsExtend); + generateImplements(classOutline.implClass, xmlRootElementsImplement); + + } + + protected void processGlobalJAXBElement(ElementOutline elementOutline) { + + generateImplements(elementOutline.implClass, jaxbElementsImplement); + + } + + protected void processGlobalComplexType(ClassOutline classOutline) { + + generateExtends(classOutline.implClass, xmlTypesExtend); + generateImplements(classOutline.implClass, xmlTypesImplement); + + } + + private void generateExtends(JDefinedClass theClass, String name) { + if (name != null) { + final JClass targetClass = theClass.owner().ref(name); + if (theClass._extends() == theClass.owner().ref(Object.class)) { + theClass._extends(targetClass); + } + } + } + + private void generateImplements(JDefinedClass theClass, String name) { + if (name != null) { + final JClass targetClass = theClass.owner().ref(name); + theClass._implements(targetClass); + } + } + + private void generateImplements(JDefinedClass theClass, List names) { + if (names != null && !names.isEmpty()) { + for (String name : names) { + generateImplements(theClass, name); + } + } + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java new file mode 100644 index 00000000..7f4aff8c --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java @@ -0,0 +1,335 @@ +package org.jvnet.jaxb2_commons.plugin.copyable; + +import java.util.Arrays; +import java.util.Collection; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.CopyStrategy; +import org.jvnet.jaxb2_commons.lang.CopyTo; +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.Customizations; +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; +import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; +import org.jvnet.jaxb2_commons.util.ClassUtils; +import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; +import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JClass; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JConditional; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JOp; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; + +public class CopyablePlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "Xcopyable"; + } + + @Override + public String getUsage() { + return "TBD"; + } + + private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; + + public FieldAccessorFactory getFieldAccessorFactory() { + return fieldAccessorFactory; + } + + public void setFieldAccessorFactory( + FieldAccessorFactory fieldAccessorFactory) { + this.fieldAccessorFactory = fieldAccessorFactory; + } + + private String copyStrategyClass = JAXBCopyStrategy.class.getName(); + + public void setCopyStrategyClass(final String copyStrategy) { + this.copyStrategyClass = copyStrategy; + } + + public String getCopyStrategyClass() { + return copyStrategyClass; + } + + public JExpression createCopyStrategy(JCodeModel codeModel) { + return StrategyClassUtils.createStrategyInstanceExpression(codeModel, + CopyStrategy.class, getCopyStrategyClass()); + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + for (final ClassOutline classOutline : outline.getClasses()) + if (!getIgnoring().isIgnored(classOutline)) { + + processClassOutline(classOutline); + } + return true; + } + + protected void processClassOutline(ClassOutline classOutline) { + final JDefinedClass theClass = classOutline.implClass; + + ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); + @SuppressWarnings("unused") + final JMethod object$clone = generateObject$clone(classOutline, + theClass); + ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); + + @SuppressWarnings("unused") + final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, + theClass); + @SuppressWarnings("unused") + final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, + theClass); + // @SuppressWarnings("unused") + // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, + // theClass); + // @SuppressWarnings("unused") + // final JMethod copyable$copyTo1 = + // generateCopyable$CopyTo1(classOutline, + // theClass); + + // @SuppressWarnings("unused") + // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( + // classOutline, theClass); + // @SuppressWarnings("unused") + // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( + // classOutline, theClass); + if (!classOutline.target.isAbstract()) { + @SuppressWarnings("unused") + final JMethod createCopy = generateCopyTo$createNewInstance( + classOutline, theClass); + + } + } + + protected JMethod generateCopyTo$createNewInstance( + final ClassOutline classOutline, final JDefinedClass theClass) { + + final JMethod existingMethod = theClass.getMethod("createNewInstance", + new JType[0]); + if (existingMethod == null) { + + final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass + .owner().ref(Object.class), "createNewInstance"); + { + final JBlock body = newMethod.body(); + body._return(JExpr._new(theClass)); + } + return newMethod; + } else { + return existingMethod; + } + } + + protected JMethod generateObject$clone(final ClassOutline classOutline, + final JDefinedClass theClass) { + + final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() + .ref(Object.class), "clone"); + { + final JBlock body = clone.body(); + body._return(JExpr.invoke("copyTo").arg( + JExpr.invoke("createNewInstance"))); + } + return clone; + } + + protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, + final JDefinedClass theClass) { + + final JCodeModel codeModel = theClass.owner(); + final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, + codeModel.ref(Object.class), "copyTo"); + { + final JVar target = copyTo$copyTo.param(Object.class, "target"); + + final JBlock body = copyTo$copyTo.body(); + final JVar copyStrategy = body.decl(JMod.FINAL, + codeModel.ref(CopyStrategy.class), "strategy", + createCopyStrategy(codeModel)); + + body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) + .arg(copyStrategy)); + } + return copyTo$copyTo; + } + + protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, + final JDefinedClass theClass) { + ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); + + final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() + .ref(Object.class), "copyTo"); + { + final JVar locator = copyTo.param(ObjectLocator.class, "locator"); + final JVar target = copyTo.param(Object.class, "target"); + final JVar copyStrategy = copyTo.param(CopyStrategy.class, + "strategy"); + + final JBlock body = copyTo.body(); + + final JVar draftCopy; + if (!classOutline.target.isAbstract()) { + draftCopy = body.decl( + JMod.FINAL, + theClass.owner().ref(Object.class), + "draftCopy", + + JOp.cond(JOp.eq(target, JExpr._null()), + JExpr.invoke("createNewInstance"), target)); + } else { + body._if(JExpr._null().eq(target)) + ._then() + ._throw(JExpr + ._new(theClass.owner().ref( + IllegalArgumentException.class)) + .arg("Target argument must not be null for abstract copyable classes.")); + draftCopy = target; + } + + Boolean superClassImplementsCopyTo = StrategyClassUtils + .superClassImplements(classOutline, getIgnoring(), + CopyTo.class); + + if (superClassImplementsCopyTo == null) { + + } else if (superClassImplementsCopyTo.booleanValue()) { + body.invoke(JExpr._super(), "copyTo").arg(locator) + .arg(draftCopy).arg(copyStrategy); + + } else { + + } + + final FieldOutline[] declaredFields = FieldOutlineUtils.filter( + classOutline.getDeclaredFields(), getIgnoring()); + + if (declaredFields.length > 0) { + + final JBlock bl = body._if(draftCopy._instanceof(theClass)) + ._then(); + + final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", + JExpr.cast(theClass, draftCopy)); + + for (final FieldOutline fieldOutline : declaredFields) { + + final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, JExpr._this()); + final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, copy); + + if (sourceFieldAccessor.isConstant()) { + continue; + } + + final JBlock block = bl.block(); + + final JBlock setValueBlock; + final JBlock unsetValueBlock; + + final JExpression valueIsSet = sourceFieldAccessor + .hasSetValue(); + + if (!sourceFieldAccessor.isAlwaysSet() + && valueIsSet != null) { + final JConditional ifValueIsSet = block._if(valueIsSet); + setValueBlock = ifValueIsSet._then(); + unsetValueBlock = ifValueIsSet._else(); + } else { + setValueBlock = block; + unsetValueBlock = null; + } + + if (setValueBlock != null) { + + final JType copyFieldType = sourceFieldAccessor + .getType(); + final JVar sourceField = setValueBlock.decl( + copyFieldType, "source" + + fieldOutline.getPropertyInfo() + .getName(true)); + sourceFieldAccessor.toRawValue(setValueBlock, + sourceField); + final JExpression builtCopy = JExpr + .invoke(copyStrategy, "copy") + .arg(theClass + .owner() + .ref(LocatorUtils.class) + .staticInvoke("property") + .arg(locator) + .arg(fieldOutline.getPropertyInfo() + .getName(false)) + .arg(sourceField)).arg(sourceField); + final JVar copyField = setValueBlock.decl( + copyFieldType, "copy" + + fieldOutline.getPropertyInfo() + .getName(true), + copyFieldType.isPrimitive() ? builtCopy : + + JExpr.cast(copyFieldType, builtCopy)); + if (copyFieldType instanceof JClass + && ((JClass) copyFieldType).isParameterized()) { + copyField.annotate(SuppressWarnings.class).param( + "value", "unchecked"); + } + copyFieldAccessor.fromRawValue(setValueBlock, "unique" + + fieldOutline.getPropertyInfo().getName(true), + copyField); + } + if (unsetValueBlock != null) { + copyFieldAccessor.unsetValues(unsetValueBlock); + + } + } + } + + body._return(draftCopy); + } + return copyTo; + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java new file mode 100644 index 00000000..9ee7f781 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.plugin.copyable; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java new file mode 100644 index 00000000..9a9ed3b8 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.plugin.elementwrapper; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java new file mode 100644 index 00000000..5a4e6ec1 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java @@ -0,0 +1,286 @@ +package org.jvnet.jaxb2_commons.plugin.elementwrapper; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; +import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; +import org.xml.sax.ErrorHandler; + +import com.sun.tools.xjc.model.Model; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class ElementWrapperPlugin extends AbstractModelPlugin { + + @Override + public String getOptionName() { + return "XelementWrapper"; + } + + @Override + public String getUsage() { + return "Generates @XmlElementWrapper annotations."; + } + + @Override + protected void postProcessModel(Model model, + final MModelInfo mmodel, ErrorHandler errorHandler) { + + final Collection> classInfos = new ArrayList>( + mmodel.getClassInfos()); + for (final MClassInfo rootClassInfo : classInfos) { + if (/* + * TODO !getIgnoring().isIgnored(classInfo) && + */true) { + List> properties = new ArrayList>( + rootClassInfo.getProperties()); + for (MPropertyInfo propertyInfo0 : properties) { + + propertyInfo0 + .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { + + @Override + public Void visitElementPropertyInfo( + final MElementPropertyInfo wrapperPropertyInfo) { + + processWrapperElementPropertyInfo(mmodel, + rootClassInfo, wrapperPropertyInfo); + return null; + + } + }); + } + } + } + + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); + } + + protected void processWrapperElementPropertyInfo( + final MModelInfo mmodel, + final MClassInfo rootClassInfo, + final MElementPropertyInfo wrapperPropertyInfo) { + wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( + new DefaultTypeInfoVisitor() { + @Override + public Void visitClassInfo( + final MClassInfo wrapperClassInfo) { + if (/* + * TODO !getIgnoring ( ).isIgnored ( classInfo ) && + */wrapperClassInfo.getProperties().size() == 1) { + final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo + .getProperties().get(0); + + if (wrappedPropertyInfo.isCollection()) { + processWrappedPropertyInfo(mmodel, + rootClassInfo, wrapperPropertyInfo, + wrapperClassInfo, wrappedPropertyInfo); + } + } + return null; + } + }); + } + + protected void processWrappedPropertyInfo( + final MModelInfo mmodel, + final MClassInfo rootClassInfo, + final MElementPropertyInfo wrapperPropertyInfo, + final MClassInfo wrapperClassInfo, + final MPropertyInfo wrappedPropertyInfo) { + wrappedPropertyInfo + .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { + + @Override + public Void visitElementPropertyInfo( + final MElementPropertyInfo wrappedPropertyInfo) { + processWrappedElementPropertyInfo(mmodel, + rootClassInfo, wrapperPropertyInfo, + wrapperClassInfo, wrappedPropertyInfo); + return null; + } + + @Override + public Void visitElementsPropertyInfo( + MElementsPropertyInfo wrappedPropertyInfo) { + processWrappedElementsPropertyInfo(mmodel, + rootClassInfo, wrapperPropertyInfo, + wrapperClassInfo, wrappedPropertyInfo); + return null; + } + + @Override + public Void visitElementRefPropertyInfo( + final MElementRefPropertyInfo wrappedPropertyInfo) { + processWrappedElementRefPropertyInfo(mmodel, + rootClassInfo, wrapperPropertyInfo, + wrapperClassInfo, wrappedPropertyInfo); + return null; + } + + @Override + public Void visitElementRefsPropertyInfo( + MElementRefsPropertyInfo wrappedPropertyInfo) { + processWrappedElementRefsPropertyInfo(mmodel, + rootClassInfo, wrapperPropertyInfo, + wrapperClassInfo, wrappedPropertyInfo); + return null; + } + }); + } + + protected void processWrappedElementPropertyInfo( + final MModelInfo mmodel, + final MClassInfo rootClassInfo, + final MElementPropertyInfo wrapperPropertyInfo, + final MClassInfo wrapperClassInfo, + final MElementPropertyInfo wrappedPropertyInfo) { + System.out.println("Class info:" + rootClassInfo.getName()); + System.out.println("Wrapper property info:" + + wrapperPropertyInfo.getPrivateName()); + System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); + System.out.println("Wrapped property info:" + + wrappedPropertyInfo.getPrivateName()); + + final MPropertyInfo propertyInfo = new CMElementPropertyInfo( + new DummyPropertyInfoOrigin(), wrapperClassInfo, + wrapperPropertyInfo.getPrivateName(), + wrappedPropertyInfo.isCollection(), + wrappedPropertyInfo.getTypeInfo(), + wrappedPropertyInfo.getElementName(), + wrapperPropertyInfo.getElementName()); + + rootClassInfo.addProperty(propertyInfo); + + // TODO + rootClassInfo.removeProperty(wrapperPropertyInfo); + mmodel.removeClassInfo(wrapperClassInfo); + } + + protected void processWrappedElementsPropertyInfo( + final MModelInfo mmodel, + final MClassInfo rootClassInfo, + final MElementPropertyInfo wrapperPropertyInfo, + final MClassInfo wrapperClassInfo, + final MElementsPropertyInfo wrappedPropertyInfo) { + System.out.println("Class info:" + rootClassInfo.getName()); + System.out.println("Wrapper property info:" + + wrapperPropertyInfo.getPrivateName()); + System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); + System.out.println("Wrapped property info:" + + wrappedPropertyInfo.getPrivateName()); + + final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( + new DummyPropertyInfoOrigin(), wrapperClassInfo, + wrapperPropertyInfo.getPrivateName(), + wrappedPropertyInfo.isCollection(), + + wrappedPropertyInfo.getElementTypeInfos(), + wrapperPropertyInfo.getElementName()); + + rootClassInfo.addProperty(propertyInfo); + + // TODO + rootClassInfo.removeProperty(wrapperPropertyInfo); + mmodel.removeClassInfo(wrapperClassInfo); + } + + protected void processWrappedElementRefPropertyInfo( + final MModelInfo mmodel, + final MClassInfo rootClassInfo, + final MElementPropertyInfo wrapperPropertyInfo, + final MClassInfo wrapperClassInfo, + final MElementRefPropertyInfo wrappedPropertyInfo) { + System.out.println("Class info:" + rootClassInfo.getName()); + System.out.println("Wrapper property info:" + + wrapperPropertyInfo.getPrivateName()); + System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); + System.out.println("Wrapped property info:" + + wrappedPropertyInfo.getPrivateName()); + + final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( + new DummyPropertyInfoOrigin(), wrapperClassInfo, + wrapperPropertyInfo.getPrivateName(), + wrappedPropertyInfo.isCollection(), + wrappedPropertyInfo.getTypeInfo(), + wrappedPropertyInfo.getElementName(), + wrapperPropertyInfo.getElementName(), + wrappedPropertyInfo.isMixed(), + wrappedPropertyInfo.isDomAllowed(), + wrappedPropertyInfo.isTypedObjectAllowed()); + + rootClassInfo.addProperty(propertyInfo); + + // TODO + rootClassInfo.removeProperty(wrapperPropertyInfo); + mmodel.removeClassInfo(wrapperClassInfo); + } + + protected void processWrappedElementRefsPropertyInfo( + final MModelInfo mmodel, + final MClassInfo rootClassInfo, + final MElementPropertyInfo wrapperPropertyInfo, + final MClassInfo wrapperClassInfo, + final MElementRefsPropertyInfo wrappedPropertyInfo) { + System.out.println("Class info:" + rootClassInfo.getName()); + System.out.println("Wrapper property info:" + + wrapperPropertyInfo.getPrivateName()); + System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); + System.out.println("Wrapped property info:" + + wrappedPropertyInfo.getPrivateName()); + + final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( + new DummyPropertyInfoOrigin(), wrapperClassInfo, + wrapperPropertyInfo.getPrivateName(), + wrappedPropertyInfo.isCollection(), + + wrappedPropertyInfo.getElementTypeInfos(), + wrapperPropertyInfo.getElementName(), + wrappedPropertyInfo.isMixed(), + wrappedPropertyInfo.isDomAllowed(), + wrappedPropertyInfo.isTypedObjectAllowed()); + + rootClassInfo.addProperty(propertyInfo); + + // TODO + rootClassInfo.removeProperty(wrapperPropertyInfo); + mmodel.removeClassInfo(wrapperClassInfo); + } + +} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java similarity index 100% rename from basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java rename to basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java new file mode 100644 index 00000000..8710a1ec --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.plugin.enumvalue; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/enumvalue"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java new file mode 100644 index 00000000..e3bbade8 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java @@ -0,0 +1,84 @@ +package org.jvnet.jaxb2_commons.plugin.enumvalue; + +import java.util.Arrays; +import java.util.Collection; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.EnumValue; +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.Customizations; +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.util.ClassUtils; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.model.CEnumLeafInfo; +import com.sun.tools.xjc.outline.Aspect; +import com.sun.tools.xjc.outline.EnumOutline; +import com.sun.tools.xjc.outline.Outline; + +public class EnumValuePlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "XenumValue"; + } + + @Override + public String getUsage() { + return "Forces generated @XmlEnums implement the org.jvnet.jaxb2_commons.lang.EnumValue interface."; + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + for (final EnumOutline enumOutline : outline.getEnums()) { + if (!getIgnoring().isIgnored(enumOutline)) { + processEnumOutline(enumOutline); + } + } + return true; + } + + protected void processEnumOutline(EnumOutline enumOutline) { + CEnumLeafInfo enumLeafInfo = enumOutline.target; + JClass enumType = enumLeafInfo.base.toType(enumOutline.parent(), + Aspect.EXPOSED).boxify(); + + final JDefinedClass theClass = enumOutline.clazz; + + ClassUtils._implements(theClass, theClass.owner().ref(EnumValue.class) + .narrow(enumType)); + + final JMethod enumValue$enumValue = theClass.method(JMod.PUBLIC, + enumType, "enumValue"); + enumValue$enumValue.body()._return(JExpr._this().invoke("value")); + } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java new file mode 100644 index 00000000..d4a2d62f --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.plugin.equals; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java new file mode 100644 index 00000000..4dbf44ca --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java @@ -0,0 +1,299 @@ +package org.jvnet.jaxb2_commons.plugin.equals; + +import java.util.Arrays; +import java.util.Collection; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Equals; +import org.jvnet.jaxb2_commons.lang.EqualsStrategy; +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.Customizations; +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; +import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; +import org.jvnet.jaxb2_commons.util.ClassUtils; +import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; +import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JConditional; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JOp; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; + +public class EqualsPlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "Xequals"; + } + + @Override + public String getUsage() { + return "TBD"; + } + + private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; + + public FieldAccessorFactory getFieldAccessorFactory() { + return fieldAccessorFactory; + } + + public void setFieldAccessorFactory( + FieldAccessorFactory fieldAccessorFactory) { + this.fieldAccessorFactory = fieldAccessorFactory; + } + + private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); + + public void setEqualsStrategyClass(String equalsStrategyClass) { + this.equalsStrategyClass = equalsStrategyClass; + } + + public String getEqualsStrategyClass() { + return equalsStrategyClass; + } + + public JExpression createEqualsStrategy(JCodeModel codeModel) { + return StrategyClassUtils.createStrategyInstanceExpression(codeModel, + EqualsStrategy.class, getEqualsStrategyClass()); + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + for (final ClassOutline classOutline : outline.getClasses()) { + if (!getIgnoring().isIgnored(classOutline)) { + processClassOutline(classOutline); + } + } + // for (final EnumOutline enumOutline : outline.getEnums()) { + // if (!getIgnoring().isIgnored(enumOutline)) { + // processEnumOutline(enumOutline); + // } + // } + return true; + } + + protected void processClassOutline(ClassOutline classOutline) { + final JDefinedClass theClass = classOutline.implClass; + ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); + + // @SuppressWarnings("unused") + // final JMethod equals0 = generateEquals$Equals0(classOutline, + // theClass); + @SuppressWarnings("unused") + final JMethod equals = generateEquals$equals(classOutline, theClass); + @SuppressWarnings("unused") + final JMethod objectEquals = generateObject$equals(classOutline, + theClass); + } + + // protected void processEnumOutline(EnumOutline enumOutline) { + // final JDefinedClass theClass = enumOutline.clazz; + // ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); + // + // @SuppressWarnings("unused") + // final JMethod equals$equals = generateEquals$equals(enumOutline, + // theClass); + // } + + protected JMethod generateObject$equals(final ClassOutline classOutline, + final JDefinedClass theClass) { + final JCodeModel codeModel = theClass.owner(); + final JMethod objectEquals = theClass.method(JMod.PUBLIC, + codeModel.BOOLEAN, "equals"); + { + final JVar object = objectEquals.param(Object.class, "object"); + final JBlock body = objectEquals.body(); + final JVar equalsStrategy = body.decl(JMod.FINAL, + codeModel.ref(EqualsStrategy.class), "strategy", + createEqualsStrategy(codeModel)); + body._return(JExpr.invoke("equals").arg(JExpr._null()) + .arg(JExpr._null()).arg(object).arg(equalsStrategy)); + } + return objectEquals; + } + + // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, + // final JDefinedClass theClass) { + // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass + // .owner().BOOLEAN, "equals"); + // { + // final JVar object = equalsEquals0.param(Object.class, "object"); + // final JVar equalsStrategy = equalsEquals0.param( + // EqualsStrategy.class, "strategy"); + // final JBlock body = equalsEquals0.body(); + // + // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( + // JExpr._null()).arg(object).arg(equalsStrategy)); + // } + // return equalsEquals0; + // } + + protected JMethod generateEquals$equals(ClassOutline classOutline, + final JDefinedClass theClass) { + + final JCodeModel codeModel = theClass.owner(); + final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, + "equals"); + { + final JBlock body = equals.body(); + final JVar leftLocator = equals.param(ObjectLocator.class, + "thisLocator"); + final JVar rightLocator = equals.param(ObjectLocator.class, + "thatLocator"); + final JVar object = equals.param(Object.class, "object"); + final JVar equalsStrategy = equals.param(EqualsStrategy.class, + "strategy"); + + final JConditional ifNotInstanceof = body._if(JOp.not(object + ._instanceof(theClass))); + ifNotInstanceof._then()._return(JExpr.FALSE); + + // + body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); + + final Boolean superClassImplementsEquals = StrategyClassUtils + .superClassImplements(classOutline, getIgnoring(), + Equals.class); + + if (superClassImplementsEquals == null) { + // No superclass + } else if (superClassImplementsEquals.booleanValue()) { + body._if( + JOp.not(JExpr._super().invoke("equals") + .arg(leftLocator).arg(rightLocator).arg(object) + .arg(equalsStrategy)))._then() + ._return(JExpr.FALSE); + + } else { + body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) + ._then()._return(JExpr.FALSE); + } + + final JExpression _this = JExpr._this(); + + final FieldOutline[] declaredFields = FieldOutlineUtils.filter( + classOutline.getDeclaredFields(), getIgnoring()); + + if (declaredFields.length > 0) { + + final JVar _that = body.decl(JMod.FINAL, theClass, "that", + JExpr.cast(theClass, object)); + + for (final FieldOutline fieldOutline : declaredFields) { + + final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, _this); + final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, _that); + + if (leftFieldAccessor.isConstant() + || rightFieldAccessor.isConstant()) { + continue; + } + + final JBlock block = body.block(); + + final String name = fieldOutline.getPropertyInfo().getName( + true); + + final JVar lhsValue = block.decl( + leftFieldAccessor.getType(), "lhs" + name); + leftFieldAccessor.toRawValue(block, lhsValue); + + final JVar rhsValue = block.decl( + rightFieldAccessor.getType(), "rhs" + name); + rightFieldAccessor.toRawValue(block, rhsValue); + + final JExpression leftFieldLocator = codeModel + .ref(LocatorUtils.class).staticInvoke("property") + .arg(leftLocator) + .arg(fieldOutline.getPropertyInfo().getName(false)) + .arg(lhsValue); + final JExpression rightFieldLocator = codeModel + .ref(LocatorUtils.class).staticInvoke("property") + .arg(rightLocator) + .arg(fieldOutline.getPropertyInfo().getName(false)) + .arg(rhsValue); + block._if( + JOp.not(JExpr.invoke(equalsStrategy, "equals") + .arg(leftFieldLocator) + .arg(rightFieldLocator).arg(lhsValue) + .arg(rhsValue)))._then() + ._return(JExpr.FALSE); + } + } + body._return(JExpr.TRUE); + } + return equals; + } + + // protected JMethod generateEquals$equals(EnumOutline enumOutline, + // final JDefinedClass theClass) { + // + // final JCodeModel codeModel = theClass.owner(); + // final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, + // "equals"); + // + // { + // final JBlock body = equals.body(); + // final JVar leftLocator = equals.param(ObjectLocator.class, + // "thisLocator"); + // final JVar rightLocator = equals.param(ObjectLocator.class, + // "thatLocator"); + // final JVar object = equals.param(Object.class, "object"); + // final JVar equalsStrategy = equals.param(EqualsStrategy.class, + // "strategy"); + // + // body._return(equalsStrategy + // .invoke("equals") + // .arg(codeModel.ref(LocatorUtils.class) + // .staticInvoke("property").arg(leftLocator) + // .arg("value").arg(JExpr._this().ref("value"))) + // .arg(codeModel.ref(LocatorUtils.class) + // .staticInvoke("property").arg(rightLocator) + // .arg("value").arg(object.ref("value"))) + // .arg(JExpr._this().ref("value")).arg(object.ref("value"))); + // + // } + // return equals; + // } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java new file mode 100644 index 00000000..8ac13732 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.plugin.hashcode; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java new file mode 100644 index 00000000..98707ed5 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java @@ -0,0 +1,258 @@ +package org.jvnet.jaxb2_commons.plugin.hashcode; + +import java.util.Arrays; +import java.util.Collection; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.HashCode; +import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; +import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.Customizations; +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; +import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; +import org.jvnet.jaxb2_commons.util.ClassUtils; +import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; +import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; + +public class HashCodePlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "XhashCode"; + } + + @Override + public String getUsage() { + return "TBD"; + } + + private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; + + public FieldAccessorFactory getFieldAccessorFactory() { + return fieldAccessorFactory; + } + + public void setFieldAccessorFactory( + FieldAccessorFactory fieldAccessorFactory) { + this.fieldAccessorFactory = fieldAccessorFactory; + } + + private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); + + public void setHashCodeStrategyClass(String hashCodeStrategy) { + this.hashCodeStrategyClass = hashCodeStrategy; + } + + public String getHashCodeStrategyClass() { + return hashCodeStrategyClass; + } + + public JExpression createHashCodeStrategy(JCodeModel codeModel) { + return StrategyClassUtils.createStrategyInstanceExpression(codeModel, + HashCodeStrategy.class, getHashCodeStrategyClass()); + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + for (final ClassOutline classOutline : outline.getClasses()) { + if (!getIgnoring().isIgnored(classOutline)) { + processClassOutline(classOutline); + } + } + // for (final EnumOutline enumOutline : outline.getEnums()) { + // if (!getIgnoring().isIgnored(enumOutline)) { + // processEnumOutline(enumOutline); + // } + // } + return true; + } + + protected void processClassOutline(ClassOutline classOutline) { + final JDefinedClass theClass = classOutline.implClass; + ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); + + // @SuppressWarnings("unused") + // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( + // classOutline, theClass); + @SuppressWarnings("unused") + final JMethod hashCode$hashCode = generateHashCode$hashCode( + classOutline, theClass); + @SuppressWarnings("unused") + final JMethod object$hashCode = generateObject$hashCode(classOutline, + theClass); + } + + // protected void processEnumOutline(EnumOutline enumOutline) { + // final JDefinedClass theClass = enumOutline.clazz; + // ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); + // + // // @SuppressWarnings("unused") + // // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( + // // classOutline, theClass); + // @SuppressWarnings("unused") + // final JMethod hashCode$hashCode = generateHashCode$hashCode( + // enumOutline, theClass); + // // @SuppressWarnings("unused") + // // final JMethod object$hashCode = generateObject$hashCode(enumOutline, + // // theClass); + // } + + protected JMethod generateObject$hashCode(final ClassOutline classOutline, + final JDefinedClass theClass) { + return generateObject$hashCode(theClass); + } + + // protected JMethod generateObject$hashCode(final EnumOutline enumOutline, + // final JDefinedClass theClass) { + // return generateObject$hashCode(theClass); + // } + + private JMethod generateObject$hashCode(final JDefinedClass theClass) { + final JMethod object$hashCode = theClass.method(JMod.PUBLIC, + theClass.owner().INT, "hashCode"); + { + final JBlock body = object$hashCode.body(); + final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass + .owner().ref(HashCodeStrategy.class), "strategy", + createHashCodeStrategy(theClass.owner())); + body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) + .arg(hashCodeStrategy)); + } + return object$hashCode; + } + + protected JMethod generateHashCode$hashCode(ClassOutline classOutline, + final JDefinedClass theClass) { + + JCodeModel codeModel = theClass.owner(); + final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, + codeModel.INT, "hashCode"); + { + final JVar locator = hashCode$hashCode.param(ObjectLocator.class, + "locator"); + final JVar hashCodeStrategy = hashCode$hashCode.param( + HashCodeStrategy.class, "strategy"); + final JBlock body = hashCode$hashCode.body(); + + final JExpression currentHashCodeExpression; + + final Boolean superClassImplementsHashCode = StrategyClassUtils + .superClassImplements(classOutline, ignoring, + HashCode.class); + + if (superClassImplementsHashCode == null) { + currentHashCodeExpression = JExpr.lit(1); + } else if (superClassImplementsHashCode.booleanValue()) { + currentHashCodeExpression = JExpr._super().invoke("hashCode") + .arg(locator).arg(hashCodeStrategy); + } else { + currentHashCodeExpression = JExpr._super().invoke("hashCode"); + } + + final JVar currentHashCode = body.decl(codeModel.INT, + "currentHashCode", currentHashCodeExpression); + + final FieldOutline[] declaredFields = FieldOutlineUtils.filter( + classOutline.getDeclaredFields(), getIgnoring()); + + if (declaredFields.length > 0) { + + for (final FieldOutline fieldOutline : declaredFields) { + final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, JExpr._this()); + if (fieldAccessor.isConstant()) { + continue; + } + final JBlock block = body.block(); + + final JVar theValue = block.decl( + fieldAccessor.getType(), + "the" + + fieldOutline.getPropertyInfo().getName( + true)); + + fieldAccessor.toRawValue(block, theValue); + + block.assign( + currentHashCode, + hashCodeStrategy + .invoke("hashCode") + .arg(codeModel + .ref(LocatorUtils.class) + .staticInvoke("property") + .arg(locator) + .arg(fieldOutline.getPropertyInfo() + .getName(false)) + .arg(theValue)) + .arg(currentHashCode).arg(theValue)); + } + } + body._return(currentHashCode); + } + return hashCode$hashCode; + } + + // protected JMethod generateHashCode$hashCode(EnumOutline enumOutline, + // final JDefinedClass theClass) { + // + // JCodeModel codeModel = theClass.owner(); + // final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, + // codeModel.INT, "hashCode"); + // final JVar locator = hashCode$hashCode.param(ObjectLocator.class, + // "locator"); + // final JVar hashCodeStrategy = hashCode$hashCode.param( + // HashCodeStrategy.class, "strategy"); + // final JBlock body = hashCode$hashCode.body(); + // + // body._return(hashCodeStrategy + // .invoke("hashCode") + // .arg(codeModel.ref(LocatorUtils.class).staticInvoke("property") + // .arg(locator).arg("value") + // .arg(JExpr._this().ref("value"))).arg(JExpr.lit(1)) + // .arg(JExpr._this().ref("value"))); + // + // return hashCode$hashCode; + // } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java new file mode 100644 index 00000000..e04c9713 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java @@ -0,0 +1,65 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.util.CustomizationUtils; + +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.CPluginCustomization; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; + + public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, + "objectFactory"); + + public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, + "extends"); + + public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, + "implements"); + + private static final JAXBContext context; + static { + try { + context = JAXBContext.newInstance(ObjectFactory.class.getPackage() + .getName(), ObjectFactory.class.getClassLoader()); + } catch (JAXBException e) { + throw new ExceptionInInitializerError(e); + } + } + + public static JAXBContext getContext() { + return context; + } + + public static void _extends(CClassInfo classInfo, String className) { + final ExtendsClass extendsClass = new ExtendsClass(); + extendsClass.setClassName(className); + final CPluginCustomization customization = CustomizationUtils + .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, + extendsClass); + classInfo.getCustomizations().add(customization); + customization.markAsAcknowledged(); + + } + + public static void _implements(CClassInfo classInfo, + String... interfaceNames) { + for (String interfaceName : interfaceNames) { + final ImplementsInterface implementsInterface = new ImplementsInterface(); + implementsInterface.setInterfaceName(interfaceName); + final CPluginCustomization customization = CustomizationUtils + .marshal(getContext(), + Customizations.IMPLEMENTS_ELEMENT_NAME, + implementsInterface); + customization.markAsAcknowledged(); + classInfo.getCustomizations().add(customization); + } + + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java new file mode 100644 index 00000000..54ca235a --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java @@ -0,0 +1,26 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") +@XmlAccessorType(XmlAccessType.PROPERTY) +public class ExtendsClass { + + private String className; + + @XmlValue + @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) + String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java new file mode 100644 index 00000000..854a4d5f --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java @@ -0,0 +1,26 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") +@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) +public class ImplementsInterface { + + private String interfaceName; + + @XmlValue + @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) + public String getInterfaceName() { + return interfaceName; + } + + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java new file mode 100644 index 00000000..95d25294 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java @@ -0,0 +1,299 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; +import org.jvnet.jaxb2_commons.util.CustomizationUtils; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.CClassRef; +import com.sun.tools.xjc.model.CCustomizations; +import com.sun.tools.xjc.model.CElementInfo; +import com.sun.tools.xjc.model.CPluginCustomization; +import com.sun.tools.xjc.model.Model; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.ElementOutline; +import com.sun.tools.xjc.outline.EnumOutline; +import com.sun.tools.xjc.outline.Outline; +import com.sun.tools.xjc.outline.PackageOutline; +import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIEnum; + +public class InheritancePlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "Xinheritance"; + } + + @Override + public String getUsage() { + return "TBD"; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, + Customizations.IMPLEMENTS_ELEMENT_NAME, + Customizations.OBJECT_FACTORY_ELEMENT_NAME); + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + final Map knownClasses = new HashMap(); + final Map knownClassInfos = new IdentityHashMap(); + + for (final ClassOutline classOutline : outline.getClasses()) { + knownClasses.put(classOutline.implClass.fullName(), + classOutline.implClass); + knownClassInfos.put(classOutline.implClass, classOutline.target); + } + for (final ClassOutline classOutline : outline.getClasses()) { + processClassOutline(classOutline, knownClasses, knownClassInfos); + } + for (final EnumOutline enumOutline : outline.getEnums()) { + processEnumOutline(enumOutline, knownClasses); + } + for (final CElementInfo elementInfo : outline.getModel() + .getAllElements()) { + final ElementOutline elementOutline = outline + .getElement(elementInfo); + if (elementOutline != null) { + processElementOutline(elementOutline, knownClasses); + } + } + processPackageOutlines(outline, knownClasses); + return true; + } + + private void processClassOutline(ClassOutline classOutline, + Map knownClasses, + Map knownClassInfos) { + + generateExtends(classOutline, knownClasses, knownClassInfos); + generateImplements(classOutline, knownClasses); + + } + + private void processEnumOutline(EnumOutline enumOutline, + Map knownClasses) { + + generateExtends(enumOutline, knownClasses); + generateImplements(enumOutline, knownClasses); + + } + + private void processElementOutline(ElementOutline elementOutline, + Map knownClasses) { + + generateExtends(elementOutline, knownClasses); + generateImplements(elementOutline, knownClasses); + + } + + private void processPackageOutlines(Outline outline, + Map knownClasses) { + List customizations = CustomizationUtils + .findCustomizations(outline, + Customizations.OBJECT_FACTORY_ELEMENT_NAME); + + for (CPluginCustomization customization : customizations) { + final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils + .unmarshall(Customizations.getContext(), customization); + + final String packageName = objectFactoryCustomization + .getPackageName(); + + if (packageName != null) { + for (PackageOutline packageOutline : outline + .getAllPackageContexts()) { + final JDefinedClass theClass = packageOutline + .objectFactory(); + if (packageName.equals(packageOutline._package().name())) { + ExtendsClass extendsClass = objectFactoryCustomization + .getExtendsClass(); + if (extendsClass != null) { + generateExtends(theClass, extendsClass, + knownClasses); + } + List implementsInterfaces = objectFactoryCustomization + .getImplementsInterface(); + if (implementsInterfaces != null) { + for (ImplementsInterface implementsInterface : implementsInterfaces) { + if (implementsInterface != null) { + generateImplements(theClass, + implementsInterface, knownClasses); + } + } + } + } + } + } + } + } + + private JClass generateExtends(ClassOutline classOutline, + Map knownClasses, + Map knownClassInfos) { + final JDefinedClass theClass = classOutline.implClass; + final CPluginCustomization extendsClassCustomization = CustomizationUtils + .findCustomization(classOutline, + Customizations.EXTENDS_ELEMENT_NAME); + JClass targetClass = generateExtends(theClass, + extendsClassCustomization, knownClasses); + + final CClassInfo classInfo = classOutline.target; + if (targetClass != null && classInfo.getBaseClass() == null + && classInfo.getRefBaseClass() == null) { + final CClassInfo targetClassInfo = knownClassInfos.get(targetClass); + if (targetClassInfo == null && classInfo.getRefBaseClass() == null) { + final Model model = classInfo.model; + // BIEnum as BIClass is protected too much + final BIEnum decl = new BIEnum(); + decl.ref = targetClass.fullName(); + final CClassRef baseClass = new CClassRef(model, + classInfo.getSchemaComponent(), decl, + new CCustomizations()); + classInfo.setBaseClass(baseClass); + } else if (targetClassInfo != null + && classInfo.getBaseClass() == null) { + classInfo.setBaseClass(targetClassInfo); + } + } + return targetClass; + } + + private JClass generateExtends(EnumOutline enumOutline, + Map knownClasses) { + final JDefinedClass theClass = enumOutline.clazz; + final CPluginCustomization extendsClassCustomization = CustomizationUtils + .findCustomization(enumOutline, + Customizations.EXTENDS_ELEMENT_NAME); + return generateExtends(theClass, extendsClassCustomization, + knownClasses); + } + + private JClass generateExtends(ElementOutline elementOutline, + Map knownClasses) { + final JDefinedClass theClass = elementOutline.implClass; + final CPluginCustomization extendsClassCustomization = CustomizationUtils + .findCustomization(elementOutline, + Customizations.EXTENDS_ELEMENT_NAME); + return generateExtends(theClass, extendsClassCustomization, + knownClasses); + } + + private JClass generateExtends(final JDefinedClass theClass, + final CPluginCustomization extendsClassCustomization, + Map knownClasses) throws AssertionError { + if (extendsClassCustomization != null) { + + final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils + .unmarshall(Customizations.getContext(), + extendsClassCustomization); + + return generateExtends(theClass, extendsClass, knownClasses); + } else { + return null; + } + } + + private JClass generateExtends(final JDefinedClass theClass, + final ExtendsClass extendsClass, Map knownClasses) { + if (extendsClass.getClassName() != null) { + final String _class = extendsClass.getClassName(); + final JClass targetClass = parseClass(_class, theClass.owner(), + knownClasses); + theClass._extends(targetClass); + return targetClass; + } else { + return null; + } + } + + private List generateImplements(ClassOutline classOutline, + Map knownClasses) { + final JDefinedClass theClass = classOutline.implClass; + final List implementsInterfaceCustomizations = CustomizationUtils + .findCustomizations(classOutline, + Customizations.IMPLEMENTS_ELEMENT_NAME); + return generateImplements(theClass, implementsInterfaceCustomizations, + knownClasses); + } + + private List generateImplements(EnumOutline enumOutline, + Map knownClasses) { + final JDefinedClass theClass = enumOutline.clazz; + final List implementsInterfaceCustomizations = CustomizationUtils + .findCustomizations(enumOutline, + Customizations.IMPLEMENTS_ELEMENT_NAME); + return generateImplements(theClass, implementsInterfaceCustomizations, + knownClasses); + } + + private List generateImplements(ElementOutline elementOutline, + Map knownClasses) { + final JDefinedClass theClass = elementOutline.implClass; + final List implementsInterfaceCustomizations = CustomizationUtils + .findCustomizations(elementOutline, + Customizations.IMPLEMENTS_ELEMENT_NAME); + return generateImplements(theClass, implementsInterfaceCustomizations, + knownClasses); + } + + private List generateImplements(final JDefinedClass theClass, + final List implementsInterfaceCustomizations, + Map knownClasses) throws AssertionError { + final List implementedInterfaces = new ArrayList( + implementsInterfaceCustomizations.size()); + for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { + if (implementsInterfaceCustomization != null) { + + final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils + .unmarshall(Customizations.getContext(), + implementsInterfaceCustomization); + + final JClass implementedInterface = generateImplements( + theClass, implementsInterface, knownClasses); + if (implementedInterface != null) { + implementedInterfaces.add(implementedInterface); + } + } + } + return implementedInterfaces; + } + + private JClass generateImplements(final JDefinedClass theClass, + final ImplementsInterface implementsInterface, + Map knownClasses) { + + String _interface = implementsInterface.getInterfaceName(); + if (_interface != null) { + final JClass targetClass = parseClass(_interface, theClass.owner(), + knownClasses); + theClass._implements(targetClass); + return targetClass; + } else { + return null; + } + } + + private JClass parseClass(String _class, JCodeModel codeModel, + Map knownClasses) { + return new JavaTypeParser(knownClasses).parseClass(_class, codeModel); + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java new file mode 100644 index 00000000..98b29f2a --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java @@ -0,0 +1,20 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance; + +import javax.xml.bind.annotation.XmlRegistry; + +@XmlRegistry +public class ObjectFactory { + + public ExtendsClass createExtendsClass() { + return new ExtendsClass(); + } + + public ImplementsInterface createImplementsInterface() { + return new ImplementsInterface(); + } + + public ObjectFactoryCustomization createObjectFactoryCustomization() { + return new ObjectFactoryCustomization(); + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java new file mode 100644 index 00000000..a4a34530 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java @@ -0,0 +1,52 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") +@XmlType(propOrder = { "extendsClass", "implementsInterface" }) +@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) +public class ObjectFactoryCustomization { + + private String packageName; + + @XmlAttribute + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + private ExtendsClass extendsClass; + + @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") + public ExtendsClass getExtendsClass() { + return extendsClass; + } + + public void setExtendsClass(ExtendsClass extendsClass) { + this.extendsClass = extendsClass; + } + + private List implementsInterface = new ArrayList(); + + @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") + public List getImplementsInterface() { + return implementsInterface; + } + + public void setImplementsInterface( + List implementsInterface) { + this.implementsInterface = implementsInterface; + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java new file mode 100644 index 00000000..2d5d07a6 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java @@ -0,0 +1,73 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance.util; + +import japa.parser.JavaParser; +import japa.parser.ParseException; +import japa.parser.ast.CompilationUnit; +import japa.parser.ast.body.ClassOrInterfaceDeclaration; +import japa.parser.ast.body.TypeDeclaration; +import japa.parser.ast.type.ClassOrInterfaceType; + +import java.io.ByteArrayInputStream; +import java.io.UnsupportedEncodingException; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.Validate; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JType; + +public class JavaTypeParser { + + static { +// JavaParser.setCacheParser(false); + } + + private final TypeToJTypeConvertingVisitor typeToJTypeConvertingVisitor; + + public JavaTypeParser() { + this(Collections. emptyMap()); + } + + public JavaTypeParser(Map knownClasses) { + Validate.notNull(knownClasses); + this.typeToJTypeConvertingVisitor = new TypeToJTypeConvertingVisitor( + knownClasses); + + } + + public JClass parseClass(String _class, JCodeModel codeModel) { + JType type = parseType(_class, codeModel); + if (type instanceof JClass) { + return (JClass) type; + } else { + throw new IllegalArgumentException("Type [" + _class + + "] is not a class."); + } + } + + private JType parseType(String type, JCodeModel codeModel) { + final String text = "public class Ignored extends " + type + " {}"; + try { + CompilationUnit compilationUnit = JavaParser.parse( + new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); + final List typeDeclarations = compilationUnit + .getTypes(); + final TypeDeclaration typeDeclaration = typeDeclarations.get(0); + final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; + final List _extended = classDeclaration + .getExtends(); + final ClassOrInterfaceType classOrInterfaceType = _extended.get(0); + + return classOrInterfaceType.accept( + this.typeToJTypeConvertingVisitor, codeModel); + } catch (ParseException pex) { + throw new IllegalArgumentException( + "Could not parse the type definition [" + type + "].", pex); + } catch (UnsupportedEncodingException uex) { + throw new UnsupportedOperationException(uex); + } + } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java new file mode 100644 index 00000000..5b8a4b7d --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java @@ -0,0 +1,130 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance.util; + +import japa.parser.ast.type.ClassOrInterfaceType; +import japa.parser.ast.type.PrimitiveType; +import japa.parser.ast.type.ReferenceType; +import japa.parser.ast.type.Type; +import japa.parser.ast.type.VoidType; +import japa.parser.ast.type.WildcardType; +import japa.parser.ast.visitor.GenericVisitorAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.Validate; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JType; + +public class TypeToJTypeConvertingVisitor extends + GenericVisitorAdapter { + + private final Map knownClasses; + + public TypeToJTypeConvertingVisitor(Map knownClasses) { + Validate.notNull(knownClasses); + this.knownClasses = knownClasses; + } + + @Override + public JType visit(VoidType type, JCodeModel codeModel) { + return codeModel.VOID; + } + + @Override + public JType visit(PrimitiveType type, JCodeModel codeModel) { + switch (type.getType()) { + case Boolean: + return codeModel.BOOLEAN; + case Char: + return codeModel.CHAR; + case Byte: + return codeModel.BYTE; + case Short: + return codeModel.SHORT; + case Int: + return codeModel.INT; + case Long: + return codeModel.LONG; + case Float: + return codeModel.FLOAT; + case Double: + return codeModel.DOUBLE; + default: + throw new AssertionError("Unknown primitive type [" + + type.getType() + "]"); + } + } + + @Override + public JType visit(ReferenceType type, JCodeModel codeModel) { + final JType referencedType = type.getType().accept(this, codeModel); + + JType referencedTypeArray = referencedType; + for (int index = 0; index < type.getArrayCount(); index++) { + referencedTypeArray = referencedTypeArray.array(); + } + return referencedTypeArray; + } + + @Override + public JType visit(WildcardType type, JCodeModel codeModel) { + + if (type.getExtends() != null) { + final ReferenceType _extends = type.getExtends(); + final JType boundType = _extends.accept(this, codeModel); + + if (!(boundType instanceof JClass)) { + throw new IllegalArgumentException("Bound type [" + _extends + + "]in the wildcard type must be class."); + } + + final JClass boundClass = (JClass) boundType; + return boundClass.wildcard(); + } else if (type.getSuper() != null) { + // TODO + throw new IllegalArgumentException( + "Wildcard types with super clause are not supported at the moment."); + } else { + throw new IllegalArgumentException( + "Wildcard type must have either extends or super clause."); + } + } + + @Override + public JType visit(ClassOrInterfaceType type, JCodeModel codeModel) { + final String name = getName(type); + final JClass knownClass = this.knownClasses.get(name); + final JClass jclass = knownClass != null ? knownClass : codeModel + .ref(name); + final List typeArgs = type.getTypeArgs(); + if (typeArgs == null || typeArgs.isEmpty()) { + return jclass; + } else { + final List jtypeArgs = new ArrayList( + typeArgs.size()); + for (Type typeArg : typeArgs) { + final JType jtype = typeArg.accept(this, codeModel); + if (!(jtype instanceof JClass)) { + throw new IllegalArgumentException("Type argument [" + + typeArg.toString() + "] is not a class."); + } else { + jtypeArgs.add((JClass) jtype); + } + } + return jclass.narrow(jtypeArgs); + } + } + + private String getName(ClassOrInterfaceType type) { + final String name = type.getName(); + final ClassOrInterfaceType scope = type.getScope(); + if (scope == null) { + return name; + } else { + return getName(scope) + "." + name; + } + } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java new file mode 100644 index 00000000..7963b722 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java @@ -0,0 +1,39 @@ +package org.jvnet.jaxb2_commons.plugin.jaxbindex; + +import org.jvnet.jaxb2_commons.util.CodeModelUtils; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.fmt.JTextFile; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.Outline; +import com.sun.tools.xjc.outline.PackageOutline; + +public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { + + public String getOptionName() { + return "Xjaxbindex"; + } + + public String getUsage() { + return "-Xjaxbindex: generate per-package jaxb.index file"; + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + + for (final PackageOutline packageOutline : outline + .getAllPackageContexts()) { + final StringBuilder sb = new StringBuilder(); + for (final ClassOutline classOutline : packageOutline.getClasses()) { + sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); + sb.append("\n"); + } + + final JTextFile indexFile = new JTextFile("jaxb.index"); + indexFile.setContents(sb.toString()); + packageOutline._package().addResourceFile(indexFile); + } + return true; + } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java new file mode 100644 index 00000000..72fad319 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.plugin.mergeable; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java new file mode 100644 index 00000000..8ca10789 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java @@ -0,0 +1,272 @@ +package org.jvnet.jaxb2_commons.plugin.mergeable; + +import java.util.Arrays; +import java.util.Collection; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; +import org.jvnet.jaxb2_commons.lang.MergeFrom; +import org.jvnet.jaxb2_commons.lang.MergeStrategy; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.Customizations; +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; +import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; +import org.jvnet.jaxb2_commons.util.ClassUtils; +import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; +import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; + +public class MergeablePlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "Xmergeable"; + } + + @Override + public String getUsage() { + return "TBD"; + } + + private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; + + public FieldAccessorFactory getFieldAccessorFactory() { + return fieldAccessorFactory; + } + + public void setFieldAccessorFactory( + FieldAccessorFactory fieldAccessorFactory) { + this.fieldAccessorFactory = fieldAccessorFactory; + } + + private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); + + public void setMergeStrategyClass( + final String mergeStrategyClass) { + this.mergeStrategyClass = mergeStrategyClass; + } + + public String getMergeStrategyClass() { + return mergeStrategyClass; + } + + public JExpression createMergeStrategy(JCodeModel codeModel) { + return StrategyClassUtils.createStrategyInstanceExpression(codeModel, + MergeStrategy.class, getMergeStrategyClass()); + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + for (final ClassOutline classOutline : outline.getClasses()) + if (!getIgnoring().isIgnored(classOutline)) { + processClassOutline(classOutline); + } + return true; + } + + protected void processClassOutline(ClassOutline classOutline) { + final JDefinedClass theClass = classOutline.implClass; + ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); + + @SuppressWarnings("unused") + final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( + classOutline, theClass); + @SuppressWarnings("unused") + final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( + classOutline, theClass); + + if (!classOutline.target.isAbstract()) { + @SuppressWarnings("unused") + final JMethod createCopy = generateMergeFrom$createNewInstance( + classOutline, theClass); + + } + } + + protected JMethod generateMergeFrom$mergeFrom0( + final ClassOutline classOutline, final JDefinedClass theClass) { + + JCodeModel codeModel = theClass.owner(); + final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, + codeModel.VOID, "mergeFrom"); + { + final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); + final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); + final JBlock body = mergeFrom$mergeFrom.body(); + + final JVar mergeStrategy = body.decl(JMod.FINAL, + codeModel.ref(MergeStrategy.class), "strategy", + createMergeStrategy(codeModel)); + + body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) + .arg(left).arg(right).arg(mergeStrategy); + } + return mergeFrom$mergeFrom; + } + + protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, + final JDefinedClass theClass) { + final JCodeModel codeModel = theClass.owner(); + + final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, + "mergeFrom"); + { + final JVar leftLocator = mergeFrom.param(ObjectLocator.class, + "leftLocator"); + final JVar rightLocator = mergeFrom.param(ObjectLocator.class, + "rightLocator"); + final JVar left = mergeFrom.param(Object.class, "left"); + final JVar right = mergeFrom.param(Object.class, "right"); + + final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, + "strategy"); + + final JBlock methodBody = mergeFrom.body(); + + Boolean superClassImplementsMergeFrom = StrategyClassUtils + .superClassImplements(classOutline, getIgnoring(), + MergeFrom.class); + + if (superClassImplementsMergeFrom == null) { + + } else if (superClassImplementsMergeFrom.booleanValue()) { + methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) + .arg(rightLocator).arg(left).arg(right) + .arg(mergeStrategy); + } else { + + } + + final FieldOutline[] declaredFields = FieldOutlineUtils.filter( + classOutline.getDeclaredFields(), getIgnoring()); + + if (declaredFields.length > 0) { + + final JBlock body = methodBody._if(right._instanceof(theClass)) + ._then(); + + JVar target = body.decl(JMod.FINAL, theClass, "target", + JExpr._this()); + JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", + JExpr.cast(theClass, left)); + JVar rightObject = body.decl(JMod.FINAL, theClass, + "rightObject", JExpr.cast(theClass, right)); + for (final FieldOutline fieldOutline : declaredFields) { + final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, leftObject); + final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, rightObject); + if (leftFieldAccessor.isConstant() + || rightFieldAccessor.isConstant()) { + continue; + } + final JBlock block = body.block(); + final JVar leftField = block.decl( + leftFieldAccessor.getType(), + "lhs" + + fieldOutline.getPropertyInfo().getName( + true)); + leftFieldAccessor.toRawValue(block, leftField); + final JVar rightField = block.decl( + rightFieldAccessor.getType(), + "rhs" + + fieldOutline.getPropertyInfo().getName( + true)); + + rightFieldAccessor.toRawValue(block, rightField); + + final JExpression leftFieldLocator = codeModel + .ref(LocatorUtils.class).staticInvoke("property") + .arg(leftLocator) + .arg(fieldOutline.getPropertyInfo().getName(false)) + .arg(leftField); + final JExpression rightFieldLocator = codeModel + .ref(LocatorUtils.class).staticInvoke("property") + .arg(rightLocator) + .arg(fieldOutline.getPropertyInfo().getName(false)) + .arg(rightField); + + final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, target); + final JExpression mergedValue = JExpr.cast( + targetFieldAccessor.getType(), + mergeStrategy.invoke("merge").arg(leftFieldLocator) + .arg(rightFieldLocator).arg(leftField) + .arg(rightField)); + + final JVar merged = block.decl( + rightFieldAccessor.getType(), + "merged" + + fieldOutline.getPropertyInfo().getName( + true), mergedValue); + + targetFieldAccessor.fromRawValue(block, "unique" + + fieldOutline.getPropertyInfo().getName(true), + + merged); + } + } + } + return mergeFrom; + } + + protected JMethod generateMergeFrom$createNewInstance( + final ClassOutline classOutline, final JDefinedClass theClass) { + + final JMethod existingMethod = theClass.getMethod("createNewInstance", + new JType[0]); + if (existingMethod == null) { + + final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass + .owner().ref(Object.class), "createNewInstance"); + { + final JBlock body = newMethod.body(); + body._return(JExpr._new(theClass)); + } + return newMethod; + } else { + return existingMethod; + } + } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java new file mode 100644 index 00000000..986a34b7 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java @@ -0,0 +1,80 @@ +package org.jvnet.jaxb2_commons.plugin.model; + +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.xml.sax.ErrorHandler; + +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.model.Model; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; +import com.sun.tools.xjc.reader.Ring; + +public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { + + protected MModelInfo getModel(Model model) { + try { + @SuppressWarnings("unchecked") + final MModelInfo modelInfo = (MModelInfo) Ring + .get(MModelInfo.class); + return modelInfo; + } catch (Throwable t) { + final MModelInfo mmodel = new XJCCMInfoFactory(model) + .createModel(); + Ring.add(MModelInfo.class, mmodel); + return mmodel; + } + } + + protected MModelOutline getModelOutline( + MModelInfo modelInfo, Outline outline, + Options options) { + try { + final MModelOutline modelOutline = (MModelOutline) Ring + .get(MModelOutline.class); + return modelOutline; + } catch (Throwable t) { + if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { + MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo + .getOrigin()).createGenerator(outline); + MModelOutline modelOutline = generator.generate(modelInfo); + Ring.add(MModelOutline.class, modelOutline); + return modelOutline; + } else { + throw new AssertionError("Model is expected to be generateable"); + } + } + } + + private MModelInfo modelInfo; + + @Override + public void postProcessModel(Model model, ErrorHandler errorHandler) { + this.modelInfo = getModel(model); + postProcessModel(model, modelInfo, errorHandler); + } + + protected void postProcessModel(Model model, + MModelInfo modelInfo, ErrorHandler errorHandler) { + // Template method to be overridden by classes + } + + @Override + protected boolean run(Outline outline, Options options) throws Exception { + if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { + MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo + .getOrigin()).createGenerator(outline); + MModelOutline modelOutline = generator.generate(modelInfo); + Ring.add(MModelOutline.class, modelOutline); + } else { + throw new AssertionError("Model is expected to be generateable"); + } + return true; + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java new file mode 100644 index 00000000..104e1c22 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.plugin.setters; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java new file mode 100644 index 00000000..fce14ff8 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java @@ -0,0 +1,168 @@ +package org.jvnet.jaxb2_commons.plugin.setters; + +import java.util.Arrays; +import java.util.Collection; + +import javax.xml.namespace.QName; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JFieldVar; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.FieldAccessor; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; + +public class SettersPlugin extends AbstractParameterizablePlugin { + + private static final JType[] ABSENT = new JType[0]; + + @Override + public String getOptionName() { + return "Xsetters"; + } + + @Override + public String getUsage() { + return "Generates setters for collections."; + } + + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + for (final ClassOutline classOutline : outline.getClasses()) + if (!getIgnoring().isIgnored(classOutline)) { + + processClassOutline(classOutline); + } + return true; + } + + protected void processClassOutline(ClassOutline classOutline) { + final JDefinedClass theClass = classOutline.implClass; + + generateSetters(classOutline, theClass); + + } + + public static enum Mode { + + accessor { + + @Override + public void generateSetter(FieldOutline fieldOutline, + JDefinedClass theClass, JMethod setter, JVar value) { + final FieldAccessor accessor = fieldOutline.create(JExpr + ._this()); + accessor.unsetValues(setter.body()); + accessor.fromRawValue(setter.body(), "draft", value); + } + }, + direct { + @Override + public void generateSetter(FieldOutline fieldOutline, + JDefinedClass theClass, JMethod setter, JVar value) { + + final JFieldVar field = theClass.fields().get( + fieldOutline.getPropertyInfo().getName(false)); + + if (field != null) { + setter.body().assign(JExpr._this().ref(field), value); + } else { + // Fallback to the accessor + Mode.accessor.generateSetter(fieldOutline, theClass, + setter, value); + } + } + }; + public abstract void generateSetter(FieldOutline fieldOutline, + JDefinedClass theClass, JMethod setter, JVar value); + } + + private Mode mode = Mode.accessor; + + public String getMode() { + return mode.name(); + + } + + public void setMode(String mode) { + Validate.notNull(mode); + try { + this.mode = Mode.valueOf(mode); + } catch (IllegalArgumentException iaex) { + throw new IllegalArgumentException( + "Unsupported mode [" + + mode + + "]." + + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" + + " and [direct] (assigns the value to the field directly)."); + } + } + + private void generateSetters(ClassOutline classOutline, + JDefinedClass theClass) { + + final FieldOutline[] declaredFields = FieldOutlineUtils.filter( + classOutline.getDeclaredFields(), getIgnoring()); + + for (final FieldOutline fieldOutline : declaredFields) { + + final String publicName = fieldOutline.getPropertyInfo().getName( + true); + + final String getterName = "get" + publicName; + + final JMethod getter = theClass.getMethod(getterName, ABSENT); + + if (getter != null) { + final JType type = getter.type(); + final JType rawType = fieldOutline.getRawType(); + final String setterName = "set" + publicName; + final JMethod boxifiedSetter = theClass.getMethod(setterName, + new JType[] { rawType.boxify() }); + final JMethod unboxifiedSetter = theClass.getMethod(setterName, + new JType[] { rawType.unboxify() }); + final JMethod setter = boxifiedSetter != null ? boxifiedSetter + : unboxifiedSetter; + + if (setter == null) { + final JMethod generatedSetter = theClass.method( + JMod.PUBLIC, theClass.owner().VOID, setterName); + final JVar value = generatedSetter.param(type, "value"); + + mode.generateSetter(fieldOutline, theClass, + generatedSetter, value); + } + } + } + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java new file mode 100644 index 00000000..0afdde9f --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java @@ -0,0 +1,18 @@ +package org.jvnet.jaxb2_commons.plugin.simplify; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + + public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( + NAMESPACE_URI, "as-element-property"); + + public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( + NAMESPACE_URI, "as-reference-property"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java new file mode 100644 index 00000000..2602700e --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java @@ -0,0 +1,278 @@ +package org.jvnet.jaxb2_commons.plugin.simplify; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.Customizations; +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.util.CustomizationUtils; +import org.xml.sax.ErrorHandler; + +import com.sun.tools.xjc.model.CAttributePropertyInfo; +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.CClassRef; +import com.sun.tools.xjc.model.CElement; +import com.sun.tools.xjc.model.CElementInfo; +import com.sun.tools.xjc.model.CElementPropertyInfo; +import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.model.CPropertyVisitor; +import com.sun.tools.xjc.model.CReferencePropertyInfo; +import com.sun.tools.xjc.model.CTypeRef; +import com.sun.tools.xjc.model.CValuePropertyInfo; +import com.sun.tools.xjc.model.Model; +import com.sun.xml.bind.v2.model.core.ID; + +public class SimplifyPlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "Xsimplify"; + } + + @Override + public String getUsage() { + return "This plugin allows simplifying \"complex\" properties" + + " (ex. aOrBOrC generated from repeatable choices)" + + " into several \"simple\" properties (ex. a, b, c).\n" + + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" + + " for plugin documentation."; + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, + org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, + org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + } + + @Override + public void postProcessModel(final Model model, ErrorHandler errorHandler) { + + for (final CClassInfo classInfo : model.beans().values()) { + postProcessClassInfo(model, classInfo); + } + } + + private void postProcessClassInfo(final Model model, + final CClassInfo classInfo) { + final List properties = new ArrayList( + classInfo.getProperties()); + for (CPropertyInfo property : properties) { + property.accept(new CPropertyVisitor() { + + public Void onElement(CElementPropertyInfo elementProperty) { + postProcessElementPropertyInfo(model, classInfo, + elementProperty); + return null; + } + + public Void onAttribute(CAttributePropertyInfo attributeProperty) { + // TODO Auto-generated method stub + return null; + } + + public Void onValue(CValuePropertyInfo valueProperty) { + // TODO Auto-generated method stub + return null; + } + + public Void onReference(CReferencePropertyInfo p) { + postProcessReferencePropertyInfo(model, classInfo, p); + return null; + } + + }); + } + } + + private void postProcessElementPropertyInfo(final Model model, + final CClassInfo classInfo, CElementPropertyInfo property) { + if (property.isCollection() && property.getTypes().size() > 1) { + if (CustomizationUtils + .containsCustomization( + property, + org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { + simplifyElementPropertyInfoAsElementPropertyInfo(model, + classInfo, property); + } + } + } + + private void postProcessReferencePropertyInfo(final Model model, + final CClassInfo classInfo, CReferencePropertyInfo property) { + if (property.isCollection() && property.getElements().size() > 1) { + if (CustomizationUtils + .containsCustomization( + property, + org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { + simplifyReferencePropertyInfoAsElementPropertyInfo(model, + classInfo, property); + } else if (CustomizationUtils + .containsCustomization( + property, + org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { + simplifyReferencePropertyInfoAsReferencePropertyInfo(model, + classInfo, property); + } + } + } + + private void simplifyElementPropertyInfoAsElementPropertyInfo( + final Model model, final CClassInfo classInfo, + CElementPropertyInfo property) { + int index = classInfo.getProperties().indexOf(property); + for (CTypeRef typeRef : property.getTypes()) { + final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( + model, property, typeRef); + classInfo.getProperties().add(index++, elementPropertyInfo); + } + classInfo.getProperties().remove(property); + } + + private void simplifyReferencePropertyInfoAsReferencePropertyInfo( + final Model model, final CClassInfo classInfo, + CReferencePropertyInfo property) { + int index = classInfo.getProperties().indexOf(property); + for (CElement element : property.getElements()) { + final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( + model, property, element); + classInfo.getProperties().add(index++, referencePropertyInfo); + } + classInfo.getProperties().remove(property); + } + + private void simplifyReferencePropertyInfoAsElementPropertyInfo( + final Model model, final CClassInfo classInfo, + CReferencePropertyInfo property) { + int index = classInfo.getProperties().indexOf(property); + for (CElement element : property.getElements()) { + final CElementPropertyInfo elementPropertyInfo; + if (element instanceof CElementInfo) { + elementPropertyInfo = createElementPropertyInfo(model, element, + (CElementInfo) element); + } else if (element instanceof CClassInfo) { + elementPropertyInfo = createElementPropertyInfo(model, element, + (CClassInfo) element); + + } else if (element instanceof CClassRef) { + // elementPropertyInfo = createElementPropertyInfo(model, + // element, + // (CClassRef) element); + elementPropertyInfo = null; + // TODO WARN + + } else { + // TODO WARN + elementPropertyInfo = null; + } + if (elementPropertyInfo != null) { + classInfo.getProperties().add(index++, elementPropertyInfo); + } + } + classInfo.getProperties().remove(property); + } + + private CElementPropertyInfo createElementPropertyInfo(final Model model, + CElement element, final CElementInfo elementInfo) { + final CElementPropertyInfo elementPropertyInfo; + final String propertyName = createPropertyName(model, element); + elementPropertyInfo = new CElementPropertyInfo(propertyName, + CollectionMode.REPEATED_ELEMENT, ID.NONE, null, + element.getSchemaComponent(), element.getCustomizations(), + element.getLocator(), false); + elementPropertyInfo.getTypes().add( + new CTypeRef(elementInfo.getContentType(), element + .getElementName(), elementInfo.getContentType() + .getTypeName(), false, null)); + return elementPropertyInfo; + } + + private CElementPropertyInfo createElementPropertyInfo(final Model model, + CElement element, final CClassInfo classInfo) { + final CElementPropertyInfo elementPropertyInfo; + final String propertyName = createPropertyName(model, element); + elementPropertyInfo = new CElementPropertyInfo(propertyName, + CollectionMode.REPEATED_ELEMENT, ID.NONE, null, + element.getSchemaComponent(), element.getCustomizations(), + element.getLocator(), false); + elementPropertyInfo.getTypes().add( + new CTypeRef(classInfo, element.getElementName(), classInfo + .getTypeName(), false, null)); + return elementPropertyInfo; + } + + // private CElementPropertyInfo createElementPropertyInfo(final Model model, + // CElement element, final CClassRef cr) { + // final CElementPropertyInfo elementPropertyInfo; + // final String propertyName = createPropertyName(model, element); + // elementPropertyInfo = new CElementPropertyInfo(propertyName, + // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, + // element.getSchemaComponent(), element.getCustomizations(), + // element.getLocator(), false); + // elementPropertyInfo.getTypes().add( + // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), + // false, null)); + // return elementPropertyInfo; + // } + + private CReferencePropertyInfo createReferencePropertyInfo( + final Model model, CReferencePropertyInfo property, CElement element) { + final String propertyName = createPropertyName(model, element); + final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( + propertyName, true, false, property.isMixed(), + element.getSchemaComponent(), element.getCustomizations(), + element.getLocator(), property.isDummy(), property.isContent(), + property.isMixedExtendedCust()); + referencePropertyInfo.getElements().add(element); + return referencePropertyInfo; + } + + private CElementPropertyInfo createElementPropertyInfo(final Model model, + CElementPropertyInfo property, CTypeRef typeRef) { + final String propertyName = createPropertyName(model, typeRef); + boolean required = false; + final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( + propertyName, CollectionMode.REPEATED_ELEMENT, typeRef + .getTarget().idUse(), typeRef.getTarget() + .getExpectedMimeType(), property.getSchemaComponent(), + property.getCustomizations(), property.getLocator(), required); + elementPropertyInfo.getTypes().add(typeRef); + return elementPropertyInfo; + } + + private String createPropertyName(final Model model, CElement element) { + final String propertyName = model.getNameConverter().toPropertyName( + element.getElementName().getLocalPart()); + return propertyName; + } + + private String createPropertyName(final Model model, CTypeRef element) { + final String propertyName = model.getNameConverter().toPropertyName( + element.getTagName().getLocalPart()); + return propertyName; + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java new file mode 100644 index 00000000..007c7d4e --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.plugin.tostring; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; + + public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, + "ignored"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java new file mode 100644 index 00000000..e5dc1b9b --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java @@ -0,0 +1,228 @@ +package org.jvnet.jaxb2_commons.plugin.tostring; + +import java.util.Arrays; +import java.util.Collection; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; +import org.jvnet.jaxb2_commons.lang.ToString; +import org.jvnet.jaxb2_commons.lang.ToStringStrategy; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.plugin.Customizations; +import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; +import org.jvnet.jaxb2_commons.plugin.Ignoring; +import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; +import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; +import org.jvnet.jaxb2_commons.util.ClassUtils; +import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; +import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; +import org.xml.sax.ErrorHandler; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; + +public class ToStringPlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "XtoString"; + } + + @Override + public String getUsage() { + return "TBD"; + } + + private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; + + public FieldAccessorFactory getFieldAccessorFactory() { + return fieldAccessorFactory; + } + + public void setFieldAccessorFactory( + FieldAccessorFactory fieldAccessorFactory) { + this.fieldAccessorFactory = fieldAccessorFactory; + } + + + private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); + + public void setToStringStrategyClass( + String toStringStrategy) { + this.toStringStrategyClass = toStringStrategy; + } + + public String getToStringStrategyClass() { + return toStringStrategyClass; + } + + public JExpression createToStringStrategy(JCodeModel codeModel) { + return StrategyClassUtils.createStrategyInstanceExpression(codeModel, + ToStringStrategy.class, getToStringStrategyClass()); + } + + private Ignoring ignoring = new CustomizedIgnoring( + org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + + public Ignoring getIgnoring() { + return ignoring; + } + + public void setIgnoring(Ignoring ignoring) { + this.ignoring = ignoring; + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList( + org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, + Customizations.IGNORED_ELEMENT_NAME, + Customizations.GENERATED_ELEMENT_NAME); + } + + @Override + public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { + for (final ClassOutline classOutline : outline.getClasses()) + if (!getIgnoring().isIgnored(classOutline)) { + processClassOutline(classOutline); + } + return true; + } + + protected void processClassOutline(ClassOutline classOutline) { + final JDefinedClass theClass = classOutline.implClass; + ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); + + @SuppressWarnings("unused") + final JMethod object$toString = generateObject$toString(classOutline, + theClass); + @SuppressWarnings("unused") + final JMethod toString$append = generateToString$append(classOutline, + theClass); + @SuppressWarnings("unused") + final JMethod toString$appendFields = generateToString$appendFields( + classOutline, theClass); + } + + protected JMethod generateObject$toString(final ClassOutline classOutline, + final JDefinedClass theClass) { + final JCodeModel codeModel = theClass.owner(); + final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel + .ref(String.class), "toString"); + { + final JBlock body = object$toString.body(); + + final JVar toStringStrategy = + + body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), + "strategy", createToStringStrategy(codeModel)); + + final JVar buffer = body.decl(JMod.FINAL, codeModel + .ref(StringBuilder.class), "buffer", JExpr._new(codeModel + .ref(StringBuilder.class))); + body.invoke("append").arg(JExpr._null()).arg(buffer).arg( + toStringStrategy); + body._return(buffer.invoke("toString")); + } + return object$toString; + } + + protected JMethod generateToString$append(final ClassOutline classOutline, + final JDefinedClass theClass) { + final JCodeModel codeModel = theClass.owner(); + final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel + .ref(StringBuilder.class), "append"); + { + + final JVar locator = toString$append.param(ObjectLocator.class, + "locator"); + final JVar buffer = toString$append.param(StringBuilder.class, + "buffer"); + final JVar toStringStrategy = toString$append.param( + ToStringStrategy.class, "strategy"); + + final JBlock body = toString$append.body(); + + body.invoke(toStringStrategy, "appendStart").arg(locator).arg( + JExpr._this()).arg(buffer); + body.invoke("appendFields").arg(locator).arg(buffer).arg( + toStringStrategy); + body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( + JExpr._this()).arg(buffer); + body._return(buffer); + } + return toString$append; + } + + protected JMethod generateToString$appendFields(ClassOutline classOutline, + final JDefinedClass theClass) { + final JCodeModel codeModel = theClass.owner(); + + final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, + codeModel.ref(StringBuilder.class), "appendFields"); + { + final JVar locator = toString$appendFields.param( + ObjectLocator.class, "locator"); + final JVar buffer = toString$appendFields.param( + StringBuilder.class, "buffer"); + final JVar toStringStrategy = toString$appendFields.param( + ToStringStrategy.class, "strategy"); + final JBlock body = toString$appendFields.body(); + + final Boolean superClassImplementsToString = StrategyClassUtils + .superClassImplements(classOutline, ignoring, + ToString.class); + + if (superClassImplementsToString == null) { + // No superclass + } else if (superClassImplementsToString.booleanValue()) { + body.invoke(JExpr._super(), "appendFields").arg(locator).arg( + buffer).arg(toStringStrategy); + } else { + // Superclass does not implement ToString + } + + final FieldOutline[] declaredFields = FieldOutlineUtils.filter( + classOutline.getDeclaredFields(), getIgnoring()); + + if (declaredFields.length > 0) { + + for (final FieldOutline fieldOutline : declaredFields) { + final JBlock block = body.block(); + final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() + .createFieldAccessor(fieldOutline, JExpr._this()); + final JVar theValue = block.decl(fieldAccessor.getType(), + "the" + + fieldOutline.getPropertyInfo().getName( + true)); + fieldAccessor.toRawValue(block, theValue); + + block.invoke(toStringStrategy, "appendField").arg(locator) + .arg(JExpr._this()).arg( + JExpr.lit(fieldOutline.getPropertyInfo() + .getName(false))).arg(buffer).arg( + theValue); + } + } + body._return(buffer); + } + return toString$appendFields; + } + +} \ No newline at end of file diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java new file mode 100644 index 00000000..d1f00231 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java @@ -0,0 +1,32 @@ +package org.jvnet.jaxb2_commons.plugin.util; + +import java.lang.reflect.Array; +import java.util.LinkedList; +import java.util.List; + +public class ArrayUtils { + + private ArrayUtils() { + + } + + public static T[] filter(T[] array, Predicate predicate, + Class theClass) { + + if (array == null) { + return null; + } else { + final List list = new LinkedList(); + for (T item : array) { + if (predicate.evaluate(item)) { + list.add(item); + } + } + @SuppressWarnings("unchecked") + final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); + return list.toArray(newArray); + } + + } + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java new file mode 100644 index 00000000..b7b67ada --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.plugin.util; + +import org.jvnet.jaxb2_commons.plugin.Ignoring; + +import com.sun.tools.xjc.outline.FieldOutline; + +public class FieldOutlineUtils { + + private FieldOutlineUtils() { + + } + + public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, + final Ignoring ignoring) { + return ArrayUtils.filter(fieldOutlines, new Predicate() { + public boolean evaluate(FieldOutline fieldOutline) { + return !ignoring.isIgnored(fieldOutline); + + } + }, FieldOutline.class); + } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java new file mode 100644 index 00000000..0c38cf47 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.plugin.util; + +public interface Predicate { + + public boolean evaluate(T object); + +} \ No newline at end of file diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java new file mode 100644 index 00000000..da6ed089 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java @@ -0,0 +1,82 @@ +package org.jvnet.jaxb2_commons.plugin.util; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.jvnet.jaxb2_commons.plugin.Ignoring; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.tools.xjc.outline.ClassOutline; + +public class StrategyClassUtils { + public static JExpression createStrategyInstanceExpression( + JCodeModel codeModel, final Class strategyInterface, + final String strategyClassName) { + + try { + final Class strategyClass = Class.forName(strategyClassName); + final JClass strategyJClass = codeModel.ref(strategyClass); + try { + final Method getInstanceMethod = strategyClass.getMethod( + "getInstance", new Class[0]); + if (getInstanceMethod != null + && strategyInterface.isAssignableFrom(getInstanceMethod + .getReturnType()) + && Modifier.isStatic(getInstanceMethod.getModifiers()) + && Modifier.isPublic(getInstanceMethod.getModifiers())) { + return strategyJClass.staticInvoke("getInstance"); + } + + } catch (Exception ignored) { + // Nothing to do + } + try { + final Field instanceField = strategyClass.getField("INSTANCE"); + if (instanceField != null + && strategyInterface.isAssignableFrom(instanceField + .getType()) + && Modifier.isStatic(instanceField.getModifiers()) + && Modifier.isPublic(instanceField.getModifiers())) { + return strategyJClass.staticRef("INSTANCE"); + } + } catch (Exception ignored) { + // Nothing to do + } + return JExpr._new(strategyJClass); + } catch (ClassNotFoundException cnfex) { + final JClass strategyJClass = codeModel.ref(strategyClassName); + return JExpr._new(strategyJClass); + } + } + + public static Boolean superClassImplements(ClassOutline classOutline, + Ignoring ignoring, Class theInterface) { + if (classOutline.target.getBaseClass() != null) { + if (!ignoring.isIgnored(classOutline.parent().getClazz( + classOutline.target.getBaseClass()))) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } else if (classOutline.target.getRefBaseClass() != null) { + try { + if (theInterface.isAssignableFrom(Class + .forName(classOutline.target.getRefBaseClass() + .fullName()))) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } catch (ClassNotFoundException ignored) { + // We'll assume it does implement + return Boolean.TRUE; + } + } else { + return null; + } + } +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java new file mode 100644 index 00000000..ea32d362 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java @@ -0,0 +1,13 @@ +package org.jvnet.jaxb2_commons.plugin.wildcard; + +import javax.xml.namespace.QName; + +public class Customizations { + + public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; + + public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); + public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); + public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); + +} diff --git a/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java new file mode 100644 index 00000000..33839b93 --- /dev/null +++ b/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java @@ -0,0 +1,97 @@ +package org.jvnet.jaxb2_commons.plugin.wildcard; + +import java.util.Arrays; +import java.util.Collection; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.jvnet.jaxb2_commons.util.CustomizationUtils; +import org.xml.sax.ErrorHandler; + +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.model.CReferencePropertyInfo; +import com.sun.tools.xjc.model.Model; +import com.sun.xml.bind.v2.model.core.WildcardMode; + +public class WildcardPlugin extends AbstractParameterizablePlugin { + + @Override + public String getOptionName() { + return "Xwildcard"; + } + + @Override + public String getUsage() { + return "Allows specifying the wildcard mode in wildcard properties."; + } + + @Override + public void postProcessModel(Model model, ErrorHandler errorHandler) { + final boolean laxModel = CustomizationUtils.containsCustomization( + model, Customizations.LAX_ELEMENT_NAME); + final boolean skipModel = CustomizationUtils.containsCustomization( + model, Customizations.SKIP_ELEMENT_NAME); + final boolean strictModel = CustomizationUtils.containsCustomization( + model, Customizations.STRICT_ELEMENT_NAME); + for (CClassInfo classInfo : model.beans().values()) { + final boolean laxClassInfo = CustomizationUtils + .containsCustomization(classInfo, + Customizations.LAX_ELEMENT_NAME); + final boolean skipClassInfo = CustomizationUtils + .containsCustomization(classInfo, + Customizations.SKIP_ELEMENT_NAME); + final boolean strictClassInfo = CustomizationUtils + .containsCustomization(classInfo, + Customizations.STRICT_ELEMENT_NAME); + for (CPropertyInfo propertyInfo : classInfo.getProperties()) { + if (propertyInfo instanceof CReferencePropertyInfo) { + final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; + final boolean laxPropertyInfo = CustomizationUtils + .containsCustomization(referencePropertyInfo, + Customizations.LAX_ELEMENT_NAME); + final boolean skipPropertyInfo = CustomizationUtils + .containsCustomization(referencePropertyInfo, + Customizations.SKIP_ELEMENT_NAME); + final boolean strictPropertyInfo = CustomizationUtils + .containsCustomization(referencePropertyInfo, + Customizations.STRICT_ELEMENT_NAME); + + if (laxModel) { + referencePropertyInfo.setWildcard(WildcardMode.LAX); + } else if (skipModel) { + referencePropertyInfo.setWildcard(WildcardMode.SKIP); + } else if (strictModel) { + referencePropertyInfo.setWildcard(WildcardMode.STRICT); + } + + if (laxClassInfo) { + referencePropertyInfo.setWildcard(WildcardMode.LAX); + } else if (skipClassInfo) { + referencePropertyInfo.setWildcard(WildcardMode.SKIP); + } else if (strictClassInfo) { + referencePropertyInfo.setWildcard(WildcardMode.STRICT); + } + + if (laxPropertyInfo) { + referencePropertyInfo.setWildcard(WildcardMode.LAX); + } else if (skipPropertyInfo) { + referencePropertyInfo.setWildcard(WildcardMode.SKIP); + } else if (strictPropertyInfo) { + referencePropertyInfo.setWildcard(WildcardMode.STRICT); + } + } + } + } + } + + @Override + public Collection getCustomizationElementNames() { + return Arrays + .asList(org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, + org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, + org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); + } + +} diff --git a/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin new file mode 100644 index 00000000..d62ace6e --- /dev/null +++ b/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin @@ -0,0 +1,13 @@ +org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin +org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin +org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin +org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin +org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin +org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin +org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin +org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin +org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin +org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin +org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin +org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin +org.jvnet.jaxb2_commons.plugin.enumvalue.EnumValuePlugin \ No newline at end of file diff --git a/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java new file mode 100644 index 00000000..c3ceb73b --- /dev/null +++ b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java @@ -0,0 +1,30 @@ +package org.jvnet.jaxb2_commons.plugin.copyable.tests; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; +import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; + +public class RunCopyablePlugin extends RunXJC2Mojo { + + @Override + public File getSchemaDirectory() { + return new File(getBaseDir(), "src/test/resources"); + } + + @Override + protected void configureMojo(AbstractXJC2Mojo mojo) { + super.configureMojo(mojo); + mojo.setForceRegenerate(true); + } + + @Override + public List getArgs() { + final List args = new ArrayList(super.getArgs()); + args.add("-Xcopyable"); + return args; + } + +} diff --git a/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java new file mode 100644 index 00000000..b29251cc --- /dev/null +++ b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java @@ -0,0 +1,30 @@ +package org.jvnet.jaxb2_commons.plugin.equals.tests; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; +import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; + +public class RunEqualsPlugin extends RunXJC2Mojo { + + @Override + public File getSchemaDirectory() { + return new File(getBaseDir(), "src/test/resources"); + } + + @Override + protected void configureMojo(AbstractXJC2Mojo mojo) { + super.configureMojo(mojo); + mojo.setForceRegenerate(true); + } + + @Override + public List getArgs() { + final List args = new ArrayList(super.getArgs()); + args.add("-Xequals"); + return args; + } + +} diff --git a/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java new file mode 100644 index 00000000..bd7ca4a8 --- /dev/null +++ b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java @@ -0,0 +1,28 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance.tests; + +import junit.framework.TestCase; + +import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JCodeModel; + +public class JavaParserTest extends TestCase { + + public void testParse() throws Exception { + + final String text = "public class Dummy implements java.util.Comparator{}"; + + final JavaTypeParser javaTypeParser = new JavaTypeParser(); + final JCodeModel codeModel = new JCodeModel(); + JClass comparator = javaTypeParser.parseClass("java.util.Comparator", + codeModel); + assertNotNull(comparator); + JClass integerComparator = javaTypeParser.parseClass( + "java.util.Comparator", codeModel); + assertNotNull(integerComparator); + JClass wildcardIntegerComparator = javaTypeParser.parseClass( + "java.util.Comparator", codeModel); + assertNotNull(wildcardIntegerComparator); + } +} diff --git a/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java new file mode 100644 index 00000000..8566557b --- /dev/null +++ b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java @@ -0,0 +1,48 @@ +package org.jvnet.jaxb2_commons.plugin.inheritance.tests; + +import japa.parser.JavaParser; +import japa.parser.ast.CompilationUnit; +import japa.parser.ast.body.ClassOrInterfaceDeclaration; +import japa.parser.ast.body.TypeDeclaration; +import japa.parser.ast.type.ClassOrInterfaceType; +import japa.parser.ast.type.ReferenceType; +import japa.parser.ast.type.Type; + +import java.io.ByteArrayInputStream; +import java.util.List; + +import junit.framework.TestCase; + +public class JavaTypeParserTest extends TestCase { + + public void testParse() throws Exception { + + final String text = "public class Dummy implements java.util.Comparator{}"; + + final CompilationUnit compilationUnit = JavaParser.parse( + new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); + final List typeDeclarations = compilationUnit + .getTypes(); + assertEquals(1, typeDeclarations.size()); + final TypeDeclaration typeDeclaration = typeDeclarations.get(0); + assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); + final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; + assertEquals("Dummy", classDeclaration.getName()); + final List implementedInterfaces = classDeclaration + .getImplements(); + assertEquals(1, implementedInterfaces.size()); + final ClassOrInterfaceType implementedInterface = implementedInterfaces + .get(0); + assertEquals("Comparator", implementedInterface.getName()); + final List typeArgs = implementedInterface.getTypeArgs(); + assertEquals(1, typeArgs.size()); + final Type typeArg = typeArgs.get(0); + assertTrue(typeArg instanceof ReferenceType); + final ReferenceType referenceTypeArg = (ReferenceType) typeArg; + final Type referencedType = referenceTypeArg.getType(); + assertTrue(referencedType instanceof ClassOrInterfaceType); + final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; + assertEquals("Integer", typeArgType.getName()); + + } +} diff --git a/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java new file mode 100644 index 00000000..8faa3469 --- /dev/null +++ b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java @@ -0,0 +1,30 @@ +package org.jvnet.jaxb2_commons.plugin.mergeable.tests; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; +import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; + +public class RunMergeablePlugin extends RunXJC2Mojo { + + @Override + public File getSchemaDirectory() { + return new File(getBaseDir(), "src/test/resources"); + } + + @Override + protected void configureMojo(AbstractXJC2Mojo mojo) { + super.configureMojo(mojo); + mojo.setForceRegenerate(true); + } + + @Override + public List getArgs() { + final List args = new ArrayList(super.getArgs()); + args.add("-Xmergeable"); + return args; + } + +} diff --git a/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java new file mode 100644 index 00000000..1d435a9e --- /dev/null +++ b/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java @@ -0,0 +1,33 @@ +package org.jvnet.jaxb2_commons.plugin.tostring.tests; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; +import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; +import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; + +public class RunToStringPlugin extends RunXJC2Mojo { + + @Override + public File getSchemaDirectory() { + return new File(getBaseDir(), "src/test/resources"); + } + + @Override + protected void configureMojo(AbstractXJC2Mojo mojo) { + super.configureMojo(mojo); + mojo.setForceRegenerate(true); + } + + @Override + public List getArgs() { + final List args = new ArrayList(super.getArgs()); + args.add("-XtoString"); + args.add("-XtoString-toStringStrategy=" + + JAXBToStringStrategy.class.getName()); + return args; + } + +} diff --git a/basic/src/test/resources/schema.xsd b/basic/src/test/resources/schema.xsd new file mode 100644 index 00000000..29a52962 --- /dev/null +++ b/basic/src/test/resources/schema.xsd @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/basics/tags/0.6.1/annotate/.classpath b/basics/tags/0.6.1/annotate/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.1/annotate/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.1/annotate/.project b/basics/tags/0.6.1/annotate/.project deleted file mode 100644 index 10d88fcb..00000000 --- a/basics/tags/0.6.1/annotate/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/annotate/pom.xml b/basics/tags/0.6.1/annotate/pom.xml deleted file mode 100644 index 22f942b7..00000000 --- a/basics/tags/0.6.1/annotate/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - jar - JAXB2 Basics - Annotate Plugin - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - commons-lang - commons-lang - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - - - com.sun.xml.bind - jaxb-impl - provided - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - provided - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - org.jvnet.annox - annox - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.1/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java b/basics/tags/0.6.1/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java deleted file mode 100644 index 86d346d9..00000000 --- a/basics/tags/0.6.1/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java +++ /dev/null @@ -1,384 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.annox.Constants; -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.parser.XAnnotationParser; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorUtils; -import org.jvnet.jaxb2_commons.util.OutlineUtils; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AnnotatePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xannotate"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private String defaultFieldTarget = "getter"; - - public String getDefaultFieldTarget() { - return defaultFieldTarget; - } - - public void setDefaultFieldTarget(String defaultFieldTarget) { - if ("getter".equals(defaultFieldTarget) - || "setter".equals(defaultFieldTarget) - || "setter-parameter".equals(defaultFieldTarget) - || "field".equals(defaultFieldTarget)) { - this.defaultFieldTarget = defaultFieldTarget; - } else { - throw new IllegalArgumentException("Invalid default field target."); - } - } - - private XAnnotationParser annotationParser = XAnnotationParser.GENERIC; - - public XAnnotationParser getAnnotationParser() { - return annotationParser; - } - - public void setAnnotationParser(XAnnotationParser annotationParser) { - this.annotationParser = annotationParser; - } - - private Annotator annotator = new Annotator(); - - public Annotator getAnnotator() { - return annotator; - } - - public void setAnnotator(Annotator annotator) { - this.annotator = annotator; - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) { - - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, options, errorHandler); - } - } - - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, options, errorHandler); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, options, errorHandler); - } - return true; - } - - protected void processElementOutline(ElementOutline elementOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - - annotateElementOutline(elementOutline.implClass.owner(), elementOutline, - customizations, errorHandler); - } - - protected void processEnumOutline(EnumOutline enumOutline, Options options, - ErrorHandler errorHandler) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumOutline); - annotateEnumOutline(enumOutline.clazz.owner(), enumOutline, - customizations, errorHandler); - - for (final EnumConstantOutline enumConstantOutline : enumOutline.constants) { - processEnumConstantOutline(enumOutline, enumConstantOutline, - options, errorHandler); - } - - } - - protected void processClassOutline(ClassOutline classOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - - annotateClassOutline(classOutline.ref.owner(), classOutline, - customizations, errorHandler); - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - processFieldOutline(classOutline, fieldOutline, options, - errorHandler); - } - - } - - private void processFieldOutline(ClassOutline classOutline, - FieldOutline fieldOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = -// fieldOutline.getPropertyInfo().getCustomizations(); - CustomizationUtils.getCustomizations(fieldOutline); - annotate(fieldOutline.parent().ref.owner(), fieldOutline, - customizations, errorHandler); - } - - private void processEnumConstantOutline(EnumOutline enumOutline, - EnumConstantOutline enumConstantOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumConstantOutline); - - annotateEnumConstantOutline(enumOutline.parent().getCodeModel(), - enumConstantOutline, customizations, errorHandler); - } - - protected void annotateElementOutline(final JCodeModel codeModel, - final ElementOutline elementOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final String namespaceURI = element.getNamespaceURI(); - if (Constants.NAMESPACE_URI.equals(namespaceURI)) { - customization.markAsAcknowledged(); - - final JAnnotatable annotatable = elementOutline.implClass; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - - protected void annotateEnumOutline(final JCodeModel codeModel, - final EnumOutline enumOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final String namespaceURI = element.getNamespaceURI(); - if (Constants.NAMESPACE_URI.equals(namespaceURI)) { - customization.markAsAcknowledged(); - - final JAnnotatable annotatable = enumOutline.clazz; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - - protected void annotateEnumConstantOutline(final JCodeModel codeModel, - final EnumConstantOutline enumConstantOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final String namespaceURI = element.getNamespaceURI(); - if (Constants.NAMESPACE_URI.equals(namespaceURI)) { - customization.markAsAcknowledged(); - - final JAnnotatable annotatable = enumConstantOutline.constRef; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - - protected void annotateClassOutline(final JCodeModel codeModel, - final ClassOutline classOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final String namespaceURI = element.getNamespaceURI(); - if (Constants.NAMESPACE_URI.equals(namespaceURI)) { - customization.markAsAcknowledged(); - - final JAnnotatable annotatable = classOutline.ref; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - - protected void annotate(final JCodeModel codeModel, - final FieldOutline fieldOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final String namespaceURI = element.getNamespaceURI(); - if (Constants.NAMESPACE_URI.equals(namespaceURI)) { - customization.markAsAcknowledged(); - - final JAnnotatable annotatable; - - final String draftTarget = element.getAttribute("target"); - - final String target; - - if (draftTarget == null || "".equals(draftTarget)) { - target = getDefaultFieldTarget(); - } else { - target = draftTarget; - } - - if ("class".equals(target)) { - annotatable = fieldOutline.parent().ref; - } else if ("getter".equals(target)) { - final JMethod _getter = FieldAccessorUtils - .getter(fieldOutline); - if (_getter == null) { - logger - .error(MessageFormat - .format( - "Could not annotate the getter of the field outline [{0}], getter method could not be found.", - - OutlineUtils - .getFieldName(fieldOutline))); - - } - annotatable = _getter; - } else if ("setter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - if (_setter == null) { - logger - .error(MessageFormat - .format( - "Could not annotate the setter of the field outline [{0}], setter method could not be found.", - - OutlineUtils - .getFieldName(fieldOutline))); - } - annotatable = _setter; - } else if ("setter-parameter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - - if (_setter == null) { - logger - .error(MessageFormat - .format( - "Could not annotate the setter parameter of the field outline [{0}], setter method could not be found.", - - OutlineUtils - .getFieldName(fieldOutline))); - annotatable = null; - } else { - final JVar[] params = _setter.listParams(); - if (params.length != 1) { - logger - .error(MessageFormat - .format( - "Could not annotate the setter parameter of the field outline [{0}], setter method must have a single parameter(this setter has {1}).", - - OutlineUtils - .getFieldName(fieldOutline), - params.length)); - annotatable = null; - } else { - annotatable = FieldAccessorUtils.setter( - fieldOutline).listParams()[0]; - } - } - } else if ("field".equals(target)) { - // Ok - final JFieldVar _field = FieldAccessorUtils - .field(fieldOutline); - if (_field == null) { - logger - .error(MessageFormat - .format( - "Could not annotate the field of the field outline [{0}] since it could not be found.", - - OutlineUtils - .getFieldName(fieldOutline))); - } - annotatable = _field; - - } else { - logger.error("Invalid annotation target [" + target + "]."); - annotatable = null; - } - - if (annotatable != null) { - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - private void annotate(final JCodeModel codeModel, - ErrorHandler errorHandler, - final CPluginCustomization customization, final Element element, - final JAnnotatable annotatable) { - final NodeList elements = element.getChildNodes(); - for (int index = 0; index < elements.getLength(); index++) { - final Node node = elements.item(index); - if (node.getNodeType() == Node.ELEMENT_NODE) { - final Element child = (Element) node; - - try { - final XAnnotation annotation = getAnnotationParser().parse( - child); - getAnnotator().annotate(codeModel, annotatable, annotation); - } catch (Exception ex) { - try { - errorHandler.error(new SAXParseException( - "Error parsing annotation.", - customization.locator, ex)); - } catch (SAXException ignored) { - // Nothing to do - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(new QName(Constants.NAMESPACE_URI, "annotate")); - } - -} diff --git a/basics/tags/0.6.1/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java b/basics/tags/0.6.1/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java deleted file mode 100644 index 92891492..00000000 --- a/basics/tags/0.6.1/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java +++ /dev/null @@ -1,304 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.lang.reflect.Field; -import java.util.Collection; -import java.util.List; - -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.model.XAnnotationField; -import org.jvnet.annox.model.XAnnotationVisitor; -import org.jvnet.annox.model.XAnnotationField.XAnnotationArray; -import org.jvnet.annox.model.XAnnotationField.XBoolean; -import org.jvnet.annox.model.XAnnotationField.XBooleanArray; -import org.jvnet.annox.model.XAnnotationField.XByte; -import org.jvnet.annox.model.XAnnotationField.XByteArray; -import org.jvnet.annox.model.XAnnotationField.XChar; -import org.jvnet.annox.model.XAnnotationField.XCharArray; -import org.jvnet.annox.model.XAnnotationField.XClass; -import org.jvnet.annox.model.XAnnotationField.XClassArray; -import org.jvnet.annox.model.XAnnotationField.XDouble; -import org.jvnet.annox.model.XAnnotationField.XDoubleArray; -import org.jvnet.annox.model.XAnnotationField.XEnum; -import org.jvnet.annox.model.XAnnotationField.XEnumArray; -import org.jvnet.annox.model.XAnnotationField.XFloat; -import org.jvnet.annox.model.XAnnotationField.XFloatArray; -import org.jvnet.annox.model.XAnnotationField.XInt; -import org.jvnet.annox.model.XAnnotationField.XIntArray; -import org.jvnet.annox.model.XAnnotationField.XLong; -import org.jvnet.annox.model.XAnnotationField.XLongArray; -import org.jvnet.annox.model.XAnnotationField.XShort; -import org.jvnet.annox.model.XAnnotationField.XShortArray; -import org.jvnet.annox.model.XAnnotationField.XString; -import org.jvnet.annox.model.XAnnotationField.XStringArray; -import org.jvnet.jaxb2_commons.util.CodeModelUtils; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationArrayMember; -import com.sun.codemodel.JAnnotationUse; -import com.sun.codemodel.JAnnotationValue; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFormatter; -import com.sun.codemodel.JType; - -public class Annotator { - - public static final Annotator INSTANCE = new Annotator(); - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - Collection xannotations) { - for (final XAnnotation xannotation : xannotations) { - if (xannotation != null) { - annotate(codeModel, annotatable, xannotation); - } - } - } - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - XAnnotation xannotation) { - final JAnnotationUse annotationUse = annotatable.annotate(xannotation - .getAnnotationClass()); - final XAnnotationVisitor visitor = createAnnotationFieldVisitor( - codeModel, annotationUse); - xannotation.accept(visitor); - - } - - protected XAnnotationVisitor createAnnotationFieldVisitor( - JCodeModel codeModel, final JAnnotationUse annotationUse) { - final XAnnotationVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return visitor; - } - - public static class AnnotatingFieldVisitor implements - XAnnotationVisitor { - - protected final JCodeModel codeModel; - - protected final JAnnotationUse use; - - public AnnotatingFieldVisitor(final JCodeModel codeModel, - final JAnnotationUse use) { - this.codeModel = codeModel; - this.use = use; - } - - public JAnnotationUse visitAnnotation(XAnnotation annotation) { - for (final XAnnotationField field : annotation.getFieldsList()) { - field.accept(this); - } - return use; - } - - public JAnnotationUse visitBooleanField(XBoolean field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitByteField(XByte field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitCharField(XChar field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitClassField(XClass field) { - JType type = CodeModelUtils.ref(codeModel, field.getClassName()); - return use.param(field.getName(), type); - } - - public JAnnotationUse visitDoubleField(XDouble field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitEnumField(XEnum field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitFloatField(XFloat field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitIntField(XInt field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitLongField(XLong field) { - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitShortField(XShort field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitStringField(XString field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitBooleanArrayField(XBooleanArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Boolean value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitByteArrayField(XByteArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Byte value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitCharArrayField(XCharArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Character value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitClassArrayField(XClassArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final String className : field.getClassNames()) { - final JType type = CodeModelUtils.ref(codeModel, className); - array.param(type); - } - return use; - } - - public JAnnotationUse visitDoubleArrayField(XDoubleArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Double value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitEnumArrayField(XEnumArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Enum value : field.getValue()) { - - final JAnnotationValue annotationValue = new JAnnotationValue() { - public void generate(JFormatter f) { - f.t(codeModel.ref(value.getDeclaringClass())).p('.').p( - value.name()); - } - }; - - addParam(array, annotationValue); - } - return use; - } - - @SuppressWarnings("unchecked") - public void addParam(final JAnnotationArrayMember array, - JAnnotationValue annotationValue) { - try { - final Field values = JAnnotationArrayMember.class - .getDeclaredField("values"); - values.setAccessible(true); - ((List) values.get(array)) - .add(annotationValue); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - public JAnnotationUse visitFloatArrayField(XFloatArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Float value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitIntArrayField(XIntArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Integer value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitShortArrayField(XShortArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Short value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitStringArrayField(XStringArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final String value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationArrayField(XAnnotationArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - final XAnnotation[] annotations = field.getValue(); - for (final XAnnotation annotation : annotations) { - - final JAnnotationUse annotationUse = array.annotate(annotation - .getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - - annotation.accept(visitor); - - } - return use; - } - - public JAnnotationUse visitLongArrayField(XLongArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Long value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationField( - org.jvnet.annox.model.XAnnotationField.XAnnotation field) { - final JAnnotationUse annotationUse = use.annotationParam(field - .getName(), field.getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return field.getValue().accept(visitor); - } - - } - -} diff --git a/basics/tags/0.6.1/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.1/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 7f3c247c..00000000 --- a/basics/tags/0.6.1/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin \ No newline at end of file diff --git a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java b/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java deleted file mode 100644 index 0d06742d..00000000 --- a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface A { - long longField(); - - int intField(); - - short shortField(); - - char charField(); - - byte byteField(); - - double doubleField(); - - float floatField(); - - boolean booleanField(); - - String stringField(); - - E enumField(); - - Class classField(); - - B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java b/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java deleted file mode 100644 index 9f27a8d4..00000000 --- a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface B { - - long[] longArrayField(); - - int[] intArrayField(); - - short[] shortArrayField(); - - char[] charArrayField(); - - byte[] byteArrayField(); - - double[] doubleArrayField(); - - float[] floatArrayField(); - - boolean[] booleanArrayField(); - - String[] stringArrayField(); - - E[] enumArrayField(); - - Class[] classArrayField(); - - B.C[] annotationArrayField(); - - @Retention(RetentionPolicy.RUNTIME) - public static @interface C { - } -} \ No newline at end of file diff --git a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java b/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java deleted file mode 100644 index 4eae4782..00000000 --- a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface D { - -} diff --git a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java b/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java deleted file mode 100644 index f8e7b4e5..00000000 --- a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -public enum E { - - ONE, TWO, THREE, FOUR; - -} \ No newline at end of file diff --git a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java b/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java deleted file mode 100644 index fd8d8c21..00000000 --- a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface F { - String value(); - -} diff --git a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java b/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java deleted file mode 100644 index 106f53db..00000000 --- a/basics/tags/0.6.1/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.project.MavenProject; -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunPluginTest extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setProject(new MavenProject()); - mojo.setForceRegenerate(true); - mojo.setExtension(true); - - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } -} diff --git a/basics/tags/0.6.1/annotate/src/test/resources/schema.xsd b/basics/tags/0.6.1/annotate/src/test/resources/schema.xsd deleted file mode 100644 index 79a863a0..00000000 --- a/basics/tags/0.6.1/annotate/src/test/resources/schema.xsd +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/ant/.classpath b/basics/tags/0.6.1/ant/.classpath deleted file mode 100644 index 82dcdf3c..00000000 --- a/basics/tags/0.6.1/ant/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/basics/tags/0.6.1/ant/.project b/basics/tags/0.6.1/ant/.project deleted file mode 100644 index 41fdd059..00000000 --- a/basics/tags/0.6.1/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/ant/pom.xml b/basics/tags/0.6.1/ant/pom.xml deleted file mode 100644 index 5aae8059..00000000 --- a/basics/tags/0.6.1/ant/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.1/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.6.1/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.6.1/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.6.1/basic/.classpath b/basics/tags/0.6.1/basic/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.1/basic/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.1/basic/.project b/basics/tags/0.6.1/basic/.project deleted file mode 100644 index 2981ba9f..00000000 --- a/basics/tags/0.6.1/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/basic/pom.xml b/basics/tags/0.6.1/basic/pom.xml deleted file mode 100644 index ed3f3212..00000000 --- a/basics/tags/0.6.1/basic/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.6.1 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - provided - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 5ebeb60a..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 51fefbea..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index 511cd361..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,337 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private Class copyStrategyClass = JAXBCopyStrategy.class; - - public void setCopyStrategyClass(final Class copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public Class getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, codeModel - .ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, codeModel - .ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl(JMod.FINAL, theClass.owner().ref( - Object.class), "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), JExpr - .invoke("createNewInstance"), target)); - } else { - body - ._if(JExpr._null().eq(target)) - ._then() - ._throw( - JExpr - ._new( - theClass - .owner() - .ref( - IllegalArgumentException.class)) - .arg( - "Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator).arg( - draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", JExpr - .cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr.invoke( - copyStrategy, "copy").arg( - theClass.owner().ref(LocatorUtils.class) - .staticInvoke("property").arg(locator) - .arg( - fieldOutline.getPropertyInfo() - .getName(false)).arg( - sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), copyFieldType - .isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 542d6255..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,255 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private Class equalsStrategyClass = JAXBEqualsStrategy.class; - - public void setEqualsStrategyClass( - Class equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public Class getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index ab419c7b..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,205 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private Class hashCodeStrategyClass = JAXBHashCodeStrategy.class; - - public void setHashCodeStrategyClass( - Class hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public Class getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, theClass - .owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass.owner() - .ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign(currentHashCode, hashCodeStrategy.invoke( - "hashCode").arg( - codeModel.ref(LocatorUtils.class).staticInvoke( - "property").arg(locator).arg( - fieldOutline.getPropertyInfo().getName( - false)).arg(theValue)).arg( - currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 57c9831f..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index e24e2e8a..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - - generateExtends(classOutline); - generateImplements(classOutline); - - } - - private void generateExtends(ClassOutline classOutline) { - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - final String name = extendsClass.getClassName(); - final JClass targetClass = classOutline.implClass.owner().ref(name); - classOutline.implClass._extends(targetClass); - } - } - - private void generateImplements(ClassOutline classOutline) { - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - if (implementsInterface.getInterfaceName() != null) { - final JClass targetClass = classOutline.implClass.owner() - .ref(implementsInterface.getInterfaceName()); - classOutline.implClass._implements(targetClass); - } - } - } - } -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 68b06829..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index 46c8ed18..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,269 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private Class mergeStrategyClass = JAXBMergeStrategy.class; - - public void setMergeStrategyClass( - final Class mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public Class getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - targetFieldAccessor.fromRawValue( - block, - "unique" - + fieldOutline.getPropertyInfo().getName( - true), - - JExpr.cast( - targetFieldAccessor.getType(), - - mergeStrategy.invoke("merge") - .arg(leftFieldLocator) - .arg(rightFieldLocator) - .arg(leftField).arg(rightField))); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index b0c69927..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(generatedSetter.body()); - accessor.fromRawValue(generatedSetter.body(), "draft", - value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index 80525091..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private Class toStringStrategyClass = JAXBToStringStrategy.class; - - public void setToStringStrategyClass( - Class toStringStrategy) { - if (!ToStringStrategy.class.isAssignableFrom(toStringStrategy)) - throw new IllegalArgumentException("The class must extend [" - + ToStringStrategy.class.getName() + "]."); - this.toStringStrategyClass = toStringStrategy; - } - - public Class getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 13d8fe6b..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final Class strategyClass) { - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index e84181a7..00000000 --- a/basics/tags/0.6.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - for (CClassInfo classInfo : model.beans().values()) { - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - - if (CustomizationUtils.containsCustomization( - classInfo, Customizations.LAX_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - - } else if (CustomizationUtils.containsCustomization( - classInfo, Customizations.SKIP_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - - } else if (CustomizationUtils.containsCustomization( - classInfo, Customizations.STRICT_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - - if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - - } else if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - - } else if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.1/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.1/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 1f990bc4..00000000 --- a/basics/tags/0.6.1/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,11 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin \ No newline at end of file diff --git a/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.6.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.6.1/basic/src/test/resources/schema.xsd b/basics/tags/0.6.1/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.6.1/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/build-1.5.bat b/basics/tags/0.6.1/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.1/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.1/build-1.6.bat b/basics/tags/0.6.1/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.1/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.1/dist/pom.xml b/basics/tags/0.6.1/dist/pom.xml deleted file mode 100644 index 12becba1..00000000 --- a/basics/tags/0.6.1/dist/pom.xml +++ /dev/null @@ -1,149 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1-SNAPSHOT - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - - diff --git a/basics/tags/0.6.1/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.6.1/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.6.1/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.1/dist/src/main/assembly/dist.xml b/basics/tags/0.6.1/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.6.1/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.1/install-1.5.bat b/basics/tags/0.6.1/install-1.5.bat deleted file mode 100644 index 24bfffb2..00000000 --- a/basics/tags/0.6.1/install-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.1/install-1.6.bat b/basics/tags/0.6.1/install-1.6.bat deleted file mode 100644 index cbb92aa4..00000000 --- a/basics/tags/0.6.1/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.1/jaxb/pom.xml b/basics/tags/0.6.1/jaxb/pom.xml deleted file mode 100644 index 0d7ededf..00000000 --- a/basics/tags/0.6.1/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.1.13.MR3 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 3 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/jaxb/xjc/pom.xml b/basics/tags/0.6.1/jaxb/xjc/pom.xml deleted file mode 100644 index 1eda0248..00000000 --- a/basics/tags/0.6.1/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.1.13.MR3 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.3 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - 2.1.13 - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/pom.xml b/basics/tags/0.6.1/pom.xml deleted file mode 100644 index f5543527..00000000 --- a/basics/tags/0.6.1/pom.xml +++ /dev/null @@ -1,356 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.6.1 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - - org.highsource.static.jaxb2-basics - ${sftp.static.highsource.org}/jaxb2-basics - - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/tags/0.6.1 - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/tags/0.6.1 - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/tags/0.6.1 - - - ant - runtime - tools - testing - basic - annotate - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - release - - - performRelease - true - - - - samples - - - - - 2.1.13 - 0.7.4 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - org.jvnet.annox - annox - 0.5.0 - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb-ri.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb-ri.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - 2.1.13.MR2 - - - - junit - junit - 3.8.1 - - - - commons-lang - commons-lang - 2.2 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.6.1/release.bat b/basics/tags/0.6.1/release.bat deleted file mode 100644 index e811a2ff..00000000 --- a/basics/tags/0.6.1/release.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn -DperformRelease=true clean deploy -endlocal diff --git a/basics/tags/0.6.1/runtime/.classpath b/basics/tags/0.6.1/runtime/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.1/runtime/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.1/runtime/.project b/basics/tags/0.6.1/runtime/.project deleted file mode 100644 index e2a9acd9..00000000 --- a/basics/tags/0.6.1/runtime/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/runtime/pom.xml b/basics/tags/0.6.1/runtime/pom.xml deleted file mode 100644 index 5aa6a2cd..00000000 --- a/basics/tags/0.6.1/runtime/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index 6a33cd15..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,295 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return ((Equals) lhs).equals(leftLocator, rightLocator, rhs, this); - } else { - return lhs.equals(rhs); - } - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index 2da953fe..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,240 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCode * iConstant - + ((HashCode) value).hashCode(locator, this); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index 2f2bb16a..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 1fcb3077..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 1cbe9fc2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - -// public Object[] getMessageParameters() { -// return new Object[] { getObject() }; -// } -// - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() - + ".messages")); - } - -// public int hashCode() { -// int hashCode = getObject().hashCode(); -// return hashCode; -// } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index f248db7e..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index d07a8eca..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index 76718546..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 578a20ef..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index b29bad1e..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MClassInfo getBaseTypeInfo(); - - public String getName(); - - public String getLocalName(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index eb91799e..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 8f896718..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 26947454..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 6afbd3b0..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index bc10b7c2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 7bf53eb7..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 318bb794..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor { - - public V visitList(MList info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - - public V visitClassInfo(MClassInfo info); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 85df90f2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index 637c8a68..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MClassInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MClassInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MClassInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index 45644f54..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - QName elementName, MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index d25eb09e..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 7a059903..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo { - - private final MEnumLeafInfoOrigin origin; - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index a70c8eb8..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,480 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - if (!list) { - return ti; - } else { - return new CMList(createListType(ti.getTargetType()), ti); - } - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - private MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()), - info.isElement() ? info.getElementName() : null); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract MPackageInfo getPackage(EI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - getTypeInfo(baseType), info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 9c4098be..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index 3a12e0d8..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,209 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 37af6535..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index a2a7eda3..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo { - - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index d2e65547..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index df1c16d2..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.6.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.6.1/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.6.1/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.6.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.6.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.6.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.6.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.6.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.6.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.6.1/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.6.1/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.6.1/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/annotate/pom.xml b/basics/tags/0.6.1/samples/annotate/pom.xml deleted file mode 100644 index aa0ac1bc..00000000 --- a/basics/tags/0.6.1/samples/annotate/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate - pom - JAXB2 Basics - Sample [annotate] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.1-SNAPSHOT - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - org.hibernate - hibernate-search - 3.0.0.GA - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/annotate/project-build.xml b/basics/tags/0.6.1/samples/annotate/project-build.xml deleted file mode 100644 index 7998d52b..00000000 --- a/basics/tags/0.6.1/samples/annotate/project-build.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/annotate/project-pom.xml b/basics/tags/0.6.1/samples/annotate/project-pom.xml deleted file mode 100644 index 762450ba..00000000 --- a/basics/tags/0.6.1/samples/annotate/project-pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate-maven - ${project.version} - jar - JAXB2 Basics - Sample [annotate-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb-ri.version} - provided - - - org.hibernate - hibernate-search - 3.0.0.GA - provided - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - - - org.hibernate - hibernate-search - 3.0.0.GA - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.1/samples/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index 0a07b0ff..00000000 --- a/basics/tags/0.6.1/samples/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.1/samples/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.1/samples/annotate/src/main/resources/schema.xsd deleted file mode 100644 index d991150f..00000000 --- a/basics/tags/0.6.1/samples/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/basic/pom.xml b/basics/tags/0.6.1/samples/basic/pom.xml deleted file mode 100644 index 86c5b087..00000000 --- a/basics/tags/0.6.1/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.1-SNAPSHOT - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/basic/project-build.xml b/basics/tags/0.6.1/samples/basic/project-build.xml deleted file mode 100644 index 6fddf3b1..00000000 --- a/basics/tags/0.6.1/samples/basic/project-build.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/basic/project-pom.xml b/basics/tags/0.6.1/samples/basic/project-pom.xml deleted file mode 100644 index 745f2a0b..00000000 --- a/basics/tags/0.6.1/samples/basic/project-pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb-ri.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/basic/src/main/assembly/src.xml b/basics/tags/0.6.1/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.6.1/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.6.1/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.6.1/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.1/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.1/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.6.1/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.1/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/basic/src/test/samples/1.xml b/basics/tags/0.6.1/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.1/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.1/samples/modular-ant/pom.xml b/basics/tags/0.6.1/samples/modular-ant/pom.xml deleted file mode 100644 index 479426c4..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.1-SNAPSHOT - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/modular-ant/project-build.xml b/basics/tags/0.6.1/samples/modular-ant/project-build.xml deleted file mode 100644 index c598b256..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.6.1/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.6.1/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.6.1/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.1/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.6.1/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.6.1/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.1/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.1/samples/po/pom.xml b/basics/tags/0.6.1/samples/po/pom.xml deleted file mode 100644 index 628994d5..00000000 --- a/basics/tags/0.6.1/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.1-SNAPSHOT - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/po/project-build.xml b/basics/tags/0.6.1/samples/po/project-build.xml deleted file mode 100644 index 401deb52..00000000 --- a/basics/tags/0.6.1/samples/po/project-build.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/po/project-pom.xml b/basics/tags/0.6.1/samples/po/project-pom.xml deleted file mode 100644 index 7f35a272..00000000 --- a/basics/tags/0.6.1/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb-ri.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.6.1/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.6.1/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.1/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.6.1/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.6.1/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.6.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.1/samples/po/src/test/resources/log4j.properties b/basics/tags/0.6.1/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.1/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/po/src/test/samples/po.xml b/basics/tags/0.6.1/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.6.1/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/pom.xml b/basics/tags/0.6.1/samples/pom.xml deleted file mode 100644 index 9b6ae14b..00000000 --- a/basics/tags/0.6.1/samples/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1-SNAPSHOT - ../pom.xml - - - po - basic - modular-ant - annotate - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/samples/src/main/assembly/ant-src.xml b/basics/tags/0.6.1/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.6.1/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.6.1/samples/src/main/assembly/maven-src.xml b/basics/tags/0.6.1/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.6.1/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.6.1/testing/.classpath b/basics/tags/0.6.1/testing/.classpath deleted file mode 100644 index e27f6e53..00000000 --- a/basics/tags/0.6.1/testing/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.1/testing/.project b/basics/tags/0.6.1/testing/.project deleted file mode 100644 index 22b73ea9..00000000 --- a/basics/tags/0.6.1/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/testing/pom.xml b/basics/tags/0.6.1/testing/pom.xml deleted file mode 100644 index 9aa5480d..00000000 --- a/basics/tags/0.6.1/testing/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.1/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.6.1/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.6.1/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.6.1/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.6.1/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.6.1/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.6.1/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.6.1/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.6.1/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.6.1/tests/annotate/.classpath b/basics/tags/0.6.1/tests/annotate/.classpath deleted file mode 100644 index c42a02b2..00000000 --- a/basics/tags/0.6.1/tests/annotate/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.1/tests/annotate/.project b/basics/tags/0.6.1/tests/annotate/.project deleted file mode 100644 index 282d843f..00000000 --- a/basics/tags/0.6.1/tests/annotate/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/tests/annotate/pom.xml b/basics/tags/0.6.1/tests/annotate/pom.xml deleted file mode 100644 index 8f807b16..00000000 --- a/basics/tags/0.6.1/tests/annotate/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-annotate - jar - JAXB2 Basics - Test [annotate] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - -Xannotate-defaultFieldTarget=setter - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.1/tests/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.1/tests/annotate/src/main/resources/schema.xsd deleted file mode 100644 index 129727c5..00000000 --- a/basics/tags/0.6.1/tests/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java b/basics/tags/0.6.1/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java deleted file mode 100644 index c59125b0..00000000 --- a/basics/tags/0.6.1/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.annotate; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunAnnotatePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } - -} diff --git a/basics/tags/0.6.1/tests/annox/.classpath b/basics/tags/0.6.1/tests/annox/.classpath deleted file mode 100644 index a225f00d..00000000 --- a/basics/tags/0.6.1/tests/annox/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/basics/tags/0.6.1/tests/annox/.project b/basics/tags/0.6.1/tests/annox/.project deleted file mode 100644 index 8686d22a..00000000 --- a/basics/tags/0.6.1/tests/annox/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/tests/annox/annotations/.classpath b/basics/tags/0.6.1/tests/annox/annotations/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.1/tests/annox/annotations/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.1/tests/annox/annotations/.project b/basics/tags/0.6.1/tests/annox/annotations/.project deleted file mode 100644 index 60d460cf..00000000 --- a/basics/tags/0.6.1/tests/annox/annotations/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox-annotations - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/tests/annox/annotations/pom.xml b/basics/tags/0.6.1/tests/annox/annotations/pom.xml deleted file mode 100644 index cd33c52c..00000000 --- a/basics/tags/0.6.1/tests/annox/annotations/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-annox-annotations - jar - JAXB2 Basics - Test [annox-annotations] - diff --git a/basics/tags/0.6.1/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java b/basics/tags/0.6.1/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java deleted file mode 100644 index 8c21043b..00000000 --- a/basics/tags/0.6.1/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface Alpha { - long longField() default 1; - - int intField() default 2; - - short shortField() default 3; - - char charField() default 'f'; - - byte byteField() default 5; - - double doubleField() default 6.0; - - float floatField() default 7.0f; - - boolean booleanField() default true; - - Digits enumField() default Digits.EIGHT; - - String stringField() default "nine"; - - @SuppressWarnings("unchecked") - Class classField() default String.class; - - // B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java b/basics/tags/0.6.1/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java deleted file mode 100644 index a8b4e3e7..00000000 --- a/basics/tags/0.6.1/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -public enum Digits { - - ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE; - -} \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/annox/pom.xml b/basics/tags/0.6.1/tests/annox/pom.xml deleted file mode 100644 index 33e3ddf3..00000000 --- a/basics/tags/0.6.1/tests/annox/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-annox - pom - JAXB2 Basics - Test [annox] - - annotations - schema - - - diff --git a/basics/tags/0.6.1/tests/annox/schema/pom.xml b/basics/tags/0.6.1/tests/annox/schema/pom.xml deleted file mode 100644 index d8afd6a1..00000000 --- a/basics/tags/0.6.1/tests/annox/schema/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-annox-schema - jar - JAXB2 Basics - Test [annox-schema] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/annox/schema/src/main/resources/binding.xjb b/basics/tags/0.6.1/tests/annox/schema/src/main/resources/binding.xjb deleted file mode 100644 index 71117799..00000000 --- a/basics/tags/0.6.1/tests/annox/schema/src/main/resources/binding.xjb +++ /dev/null @@ -1,20 +0,0 @@ - - - jaxb:extensionBindingPrefixes="annox" - - - - - - 0 - 3 - - - - - diff --git a/basics/tags/0.6.1/tests/annox/schema/src/main/resources/schema.xsd b/basics/tags/0.6.1/tests/annox/schema/src/main/resources/schema.xsd deleted file mode 100644 index 7408ec40..00000000 --- a/basics/tags/0.6.1/tests/annox/schema/src/main/resources/schema.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - 0 - 3 - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/build-1.5.bat b/basics/tags/0.6.1/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.1/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/build-1.6.bat b/basics/tags/0.6.1/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.1/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/episodes/a/pom.xml b/basics/tags/0.6.1/tests/episodes/a/pom.xml deleted file mode 100644 index b5b4451b..00000000 --- a/basics/tags/0.6.1/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.6.1/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.1/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.6.1/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.6.1/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.1/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.6.1/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.6.1/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/episodes/b/pom.xml b/basics/tags/0.6.1/tests/episodes/b/pom.xml deleted file mode 100644 index e445cf3c..00000000 --- a/basics/tags/0.6.1/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.6.1/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.1/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.6.1/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.6.1/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.6.1/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.6.1/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.1/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.6.1/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.6.1/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/episodes/pom.xml b/basics/tags/0.6.1/tests/episodes/pom.xml deleted file mode 100644 index b65ad75b..00000000 --- a/basics/tags/0.6.1/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/ignoring/pom.xml b/basics/tags/0.6.1/tests/ignoring/pom.xml deleted file mode 100644 index da32b692..00000000 --- a/basics/tags/0.6.1/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.1/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.6.1/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.6.1/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/issues/.classpath b/basics/tags/0.6.1/tests/issues/.classpath deleted file mode 100644 index 8f134b1c..00000000 --- a/basics/tags/0.6.1/tests/issues/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.1/tests/issues/.project b/basics/tags/0.6.1/tests/issues/.project deleted file mode 100644 index d98a2c30..00000000 --- a/basics/tags/0.6.1/tests/issues/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/tests/issues/pom.xml b/basics/tags/0.6.1/tests/issues/pom.xml deleted file mode 100644 index c54c218d..00000000 --- a/basics/tags/0.6.1/tests/issues/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - -Xsetters - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.6.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.6.1/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.6.1/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index ed59782e..00000000 --- a/basics/tags/0.6.1/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 88bf03d0..00000000 --- a/basics/tags/0.6.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args - .add("-XautoInheritance-globalElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args - .add("-XautoInheritance-globalElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args - .add("-XautoInheritance-globalElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - - return args; - } - -} diff --git a/basics/tags/0.6.1/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.6.1/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.6.1/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/one/.classpath b/basics/tags/0.6.1/tests/one/.classpath deleted file mode 100644 index c42a02b2..00000000 --- a/basics/tags/0.6.1/tests/one/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.1/tests/one/.project b/basics/tags/0.6.1/tests/one/.project deleted file mode 100644 index fb3eacf0..00000000 --- a/basics/tags/0.6.1/tests/one/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/tests/one/pom.xml b/basics/tags/0.6.1/tests/one/pom.xml deleted file mode 100644 index d1e50291..00000000 --- a/basics/tags/0.6.1/tests/one/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.1-SNAPSHOT - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.1/tests/one/src/main/resources/schema.xsd b/basics/tags/0.6.1/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index 01a8c31b..00000000 --- a/basics/tags/0.6.1/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.6.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.1/tests/one/src/test/resources/log4j.properties b/basics/tags/0.6.1/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.1/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/one/src/test/samples/1.xml b/basics/tags/0.6.1/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.1/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.1/tests/one/src/test/samples/2.xml b/basics/tags/0.6.1/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.6.1/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.6.1/tests/pom.xml b/basics/tags/0.6.1/tests/pom.xml deleted file mode 100644 index 138b020f..00000000 --- a/basics/tags/0.6.1/tests/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1-SNAPSHOT - ../pom.xml - - - annotate - annox - episodes - one - issues - zj - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - - generate - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/zj/pom.xml b/basics/tags/0.6.1/tests/zj/pom.xml deleted file mode 100644 index a8d4e03e..00000000 --- a/basics/tags/0.6.1/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.1/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.6.1/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.6.1/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.6.1/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.6.1/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.1/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.6.1/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.1/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.1/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.6.1/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.6.1/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.6.1/tools/.classpath b/basics/tags/0.6.1/tools/.classpath deleted file mode 100644 index 24166ba5..00000000 --- a/basics/tags/0.6.1/tools/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/basics/tags/0.6.1/tools/.project b/basics/tags/0.6.1/tools/.project deleted file mode 100644 index 89093281..00000000 --- a/basics/tags/0.6.1/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.1/tools/pom.xml b/basics/tags/0.6.1/tools/pom.xml deleted file mode 100644 index 26795def..00000000 --- a/basics/tags/0.6.1/tools/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.1 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - commons-lang - commons-lang - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index 4fea93c7..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!StringUtils.isEmpty(namespaceURI)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d4ca11b5..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 7e396304..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,497 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find(name - .getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find(name - .getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find(name - .getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find(name - .getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find(name - .getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find(name - .getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find(name - .getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations(model - .getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations(propertyInfo - .getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index 686a8189..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,200 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index a7e6b211..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = parent.getParent().getClassOutline( - classInfo.getBaseTypeInfo()); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 16f45c22..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 9535bcaa..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 59cda4e0..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index 2e6d3fa8..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - generateClassOutline(modelOutline, modelInfo, - classInfo.getBaseTypeInfo()); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index ee45b6b0..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index e43958e1..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 41dcc73f..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - public XJCCMInfoFactory(Model model) { - super(model); - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - private final Map packages = new HashMap(); - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 946ab670..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index f855af96..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index 7d59132d..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 4414b8ae..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 0c5e02a0..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index 7f414d27..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 70f7489d..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index d98988d0..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index b6673c80..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index b7df6bbe..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 1d3a1f57..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 517cbb27..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index ef8a2639..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index 5d7c77a2..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c632055a..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 7cd5160b..00000000 --- a/basics/tags/0.6.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/tags/0.6.1/update-jaxb2-commons-versions.bat b/basics/tags/0.6.1/update-jaxb2-commons-versions.bat deleted file mode 100644 index fd4e1749..00000000 --- a/basics/tags/0.6.1/update-jaxb2-commons-versions.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -call update-versions ../basics %1 %2 \ No newline at end of file diff --git a/basics/tags/0.6.1/update-version.bat b/basics/tags/0.6.1/update-version.bat deleted file mode 100644 index 8a52b653..00000000 --- a/basics/tags/0.6.1/update-version.bat +++ /dev/null @@ -1,3 +0,0 @@ -sed "s/%2/%3/g" %1 > %1.tmp -del %1 -move %1.tmp %1 \ No newline at end of file diff --git a/basics/tags/0.6.1/update-versions.bat b/basics/tags/0.6.1/update-versions.bat deleted file mode 100644 index 1499b4f4..00000000 --- a/basics/tags/0.6.1/update-versions.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -for /R %1 %%x in (pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.classpath) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.tomcatplugin) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-build.xml) do if exist %%x call update-version %%x %2 %3 diff --git a/basics/tags/0.6.2/annotate/.classpath b/basics/tags/0.6.2/annotate/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.2/annotate/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.2/annotate/.project b/basics/tags/0.6.2/annotate/.project deleted file mode 100644 index 10d88fcb..00000000 --- a/basics/tags/0.6.2/annotate/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/annotate/pom.xml b/basics/tags/0.6.2/annotate/pom.xml deleted file mode 100644 index 1360fb3e..00000000 --- a/basics/tags/0.6.2/annotate/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - jar - JAXB2 Basics - Annotate Plugin - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - commons-lang - commons-lang - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - org.jvnet.annox - annox - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.2/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java b/basics/tags/0.6.2/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java deleted file mode 100644 index 9678b232..00000000 --- a/basics/tags/0.6.2/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java +++ /dev/null @@ -1,409 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.annox.Constants; -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.parser.XAnnotationParser; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorUtils; -import org.jvnet.jaxb2_commons.util.OutlineUtils; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AnnotatePlugin extends AbstractParameterizablePlugin { - - private static final QName ANNOTATE_PROPERTY_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateProperty"); - private static final QName ANNOTATE_CLASS_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateClass"); - private static final QName ANNOTATE_ELEMENT_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateElement"); - private static final QName ANNOTATE_ENUM_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateEnum"); - private static final QName ANNOTATE_ENUM_CONSTANT_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateEnumConstant"); - private static final QName ANNOTATE_QNAME = new QName( - Constants.NAMESPACE_URI, "annotate"); - - @Override - public String getOptionName() { - return "Xannotate"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private String defaultFieldTarget = "getter"; - - public String getDefaultFieldTarget() { - return defaultFieldTarget; - } - - public void setDefaultFieldTarget(String defaultFieldTarget) { - if ("getter".equals(defaultFieldTarget) - || "setter".equals(defaultFieldTarget) - || "setter-parameter".equals(defaultFieldTarget) - || "field".equals(defaultFieldTarget)) { - this.defaultFieldTarget = defaultFieldTarget; - } else { - throw new IllegalArgumentException("Invalid default field target."); - } - } - - private XAnnotationParser annotationParser = XAnnotationParser.GENERIC; - - public XAnnotationParser getAnnotationParser() { - return annotationParser; - } - - public void setAnnotationParser(XAnnotationParser annotationParser) { - this.annotationParser = annotationParser; - } - - private Annotator annotator = new Annotator(); - - public Annotator getAnnotator() { - return annotator; - } - - public void setAnnotator(Annotator annotator) { - this.annotator = annotator; - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) { - - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, options, errorHandler); - } - } - - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, options, errorHandler); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, options, errorHandler); - } - return true; - } - - protected void processElementOutline(ElementOutline elementOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - - annotateElementOutline(elementOutline.implClass.owner(), - elementOutline, customizations, errorHandler); - } - - protected void processEnumOutline(EnumOutline enumOutline, Options options, - ErrorHandler errorHandler) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumOutline); - annotateEnumOutline(enumOutline.clazz.owner(), enumOutline, - customizations, errorHandler); - - for (final EnumConstantOutline enumConstantOutline : enumOutline.constants) { - processEnumConstantOutline(enumOutline, enumConstantOutline, - options, errorHandler); - } - - } - - protected void processClassOutline(ClassOutline classOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - - annotateClassOutline(classOutline.ref.owner(), classOutline, - customizations, errorHandler); - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - processFieldOutline(classOutline, fieldOutline, options, - errorHandler); - } - - } - - private void processFieldOutline(ClassOutline classOutline, - FieldOutline fieldOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - annotate(fieldOutline.parent().ref.owner(), fieldOutline, - customizations, errorHandler); - } - - private void processEnumConstantOutline(EnumOutline enumOutline, - EnumConstantOutline enumConstantOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumConstantOutline); - - annotateEnumConstantOutline(enumOutline.parent().getCodeModel(), - enumConstantOutline, customizations, errorHandler); - } - - protected void annotateElementOutline(final JCodeModel codeModel, - final ElementOutline elementOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ELEMENT_QNAME.equals(name)) { - - final JAnnotatable annotatable = elementOutline.implClass; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotateEnumOutline(final JCodeModel codeModel, - final EnumOutline enumOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ENUM_QNAME.equals(name)) { - - final JAnnotatable annotatable = enumOutline.clazz; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotateEnumConstantOutline(final JCodeModel codeModel, - final EnumConstantOutline enumConstantOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ENUM_CONSTANT_QNAME.equals(name)) { - - final JAnnotatable annotatable = enumConstantOutline.constRef; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - - } - } - } - } - - protected void annotateClassOutline(final JCodeModel codeModel, - final ClassOutline classOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - - customization.markAsAcknowledged(); - if (ANNOTATE_CLASS_QNAME.equals(name) - || ANNOTATE_QNAME.equals(name)) { - - final JAnnotatable annotatable = classOutline.ref; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotate(final JCodeModel codeModel, - final FieldOutline fieldOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_PROPERTY_QNAME.equals(name)) { - - final JAnnotatable annotatable; - - final String draftTarget = element.getAttribute("target"); - - final String target; - - if (draftTarget == null || "".equals(draftTarget)) { - target = getDefaultFieldTarget(); - } else { - target = draftTarget; - } - - if ("class".equals(target)) { - annotatable = fieldOutline.parent().ref; - } else if ("getter".equals(target)) { - final JMethod _getter = FieldAccessorUtils - .getter(fieldOutline); - if (_getter == null) { - logger.error(MessageFormat - .format("Could not annotate the getter of the field outline [{0}], getter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - - } - annotatable = _getter; - } else if ("setter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - if (_setter == null) { - logger.error(MessageFormat - .format("Could not annotate the setter of the field outline [{0}], setter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - } - annotatable = _setter; - } else if ("setter-parameter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - - if (_setter == null) { - logger.error(MessageFormat - .format("Could not annotate the setter parameter of the field outline [{0}], setter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - annotatable = null; - } else { - final JVar[] params = _setter.listParams(); - if (params.length != 1) { - logger.error(MessageFormat - .format("Could not annotate the setter parameter of the field outline [{0}], setter method must have a single parameter(this setter has {1}).", - - OutlineUtils - .getFieldName(fieldOutline), - params.length)); - annotatable = null; - } else { - annotatable = FieldAccessorUtils.setter( - fieldOutline).listParams()[0]; - } - } - } else if ("field".equals(target)) { - // Ok - final JFieldVar _field = FieldAccessorUtils - .field(fieldOutline); - if (_field == null) { - logger.error(MessageFormat - .format("Could not annotate the field of the field outline [{0}] since it could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - } - annotatable = _field; - - } else { - logger.error("Invalid annotation target [" + target - + "]."); - annotatable = null; - } - - if (annotatable != null) { - - annotate(codeModel, errorHandler, customization, - element, annotatable); - } - } - } - } - } - - private void annotate(final JCodeModel codeModel, - ErrorHandler errorHandler, - final CPluginCustomization customization, final Element element, - final JAnnotatable annotatable) { - final NodeList elements = element.getChildNodes(); - for (int index = 0; index < elements.getLength(); index++) { - final Node node = elements.item(index); - if (node.getNodeType() == Node.ELEMENT_NODE) { - final Element child = (Element) node; - - try { - final XAnnotation annotation = getAnnotationParser().parse( - child); - getAnnotator().annotate(codeModel, annotatable, annotation); - } catch (Exception ex) { - try { - errorHandler.error(new SAXParseException( - "Error parsing annotation.", - customization.locator, ex)); - } catch (SAXException ignored) { - // Nothing to do - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(ANNOTATE_QNAME, ANNOTATE_CLASS_QNAME, - ANNOTATE_ELEMENT_QNAME, ANNOTATE_PROPERTY_QNAME); - } - -} diff --git a/basics/tags/0.6.2/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java b/basics/tags/0.6.2/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java deleted file mode 100644 index 92891492..00000000 --- a/basics/tags/0.6.2/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java +++ /dev/null @@ -1,304 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.lang.reflect.Field; -import java.util.Collection; -import java.util.List; - -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.model.XAnnotationField; -import org.jvnet.annox.model.XAnnotationVisitor; -import org.jvnet.annox.model.XAnnotationField.XAnnotationArray; -import org.jvnet.annox.model.XAnnotationField.XBoolean; -import org.jvnet.annox.model.XAnnotationField.XBooleanArray; -import org.jvnet.annox.model.XAnnotationField.XByte; -import org.jvnet.annox.model.XAnnotationField.XByteArray; -import org.jvnet.annox.model.XAnnotationField.XChar; -import org.jvnet.annox.model.XAnnotationField.XCharArray; -import org.jvnet.annox.model.XAnnotationField.XClass; -import org.jvnet.annox.model.XAnnotationField.XClassArray; -import org.jvnet.annox.model.XAnnotationField.XDouble; -import org.jvnet.annox.model.XAnnotationField.XDoubleArray; -import org.jvnet.annox.model.XAnnotationField.XEnum; -import org.jvnet.annox.model.XAnnotationField.XEnumArray; -import org.jvnet.annox.model.XAnnotationField.XFloat; -import org.jvnet.annox.model.XAnnotationField.XFloatArray; -import org.jvnet.annox.model.XAnnotationField.XInt; -import org.jvnet.annox.model.XAnnotationField.XIntArray; -import org.jvnet.annox.model.XAnnotationField.XLong; -import org.jvnet.annox.model.XAnnotationField.XLongArray; -import org.jvnet.annox.model.XAnnotationField.XShort; -import org.jvnet.annox.model.XAnnotationField.XShortArray; -import org.jvnet.annox.model.XAnnotationField.XString; -import org.jvnet.annox.model.XAnnotationField.XStringArray; -import org.jvnet.jaxb2_commons.util.CodeModelUtils; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationArrayMember; -import com.sun.codemodel.JAnnotationUse; -import com.sun.codemodel.JAnnotationValue; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFormatter; -import com.sun.codemodel.JType; - -public class Annotator { - - public static final Annotator INSTANCE = new Annotator(); - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - Collection xannotations) { - for (final XAnnotation xannotation : xannotations) { - if (xannotation != null) { - annotate(codeModel, annotatable, xannotation); - } - } - } - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - XAnnotation xannotation) { - final JAnnotationUse annotationUse = annotatable.annotate(xannotation - .getAnnotationClass()); - final XAnnotationVisitor visitor = createAnnotationFieldVisitor( - codeModel, annotationUse); - xannotation.accept(visitor); - - } - - protected XAnnotationVisitor createAnnotationFieldVisitor( - JCodeModel codeModel, final JAnnotationUse annotationUse) { - final XAnnotationVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return visitor; - } - - public static class AnnotatingFieldVisitor implements - XAnnotationVisitor { - - protected final JCodeModel codeModel; - - protected final JAnnotationUse use; - - public AnnotatingFieldVisitor(final JCodeModel codeModel, - final JAnnotationUse use) { - this.codeModel = codeModel; - this.use = use; - } - - public JAnnotationUse visitAnnotation(XAnnotation annotation) { - for (final XAnnotationField field : annotation.getFieldsList()) { - field.accept(this); - } - return use; - } - - public JAnnotationUse visitBooleanField(XBoolean field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitByteField(XByte field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitCharField(XChar field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitClassField(XClass field) { - JType type = CodeModelUtils.ref(codeModel, field.getClassName()); - return use.param(field.getName(), type); - } - - public JAnnotationUse visitDoubleField(XDouble field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitEnumField(XEnum field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitFloatField(XFloat field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitIntField(XInt field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitLongField(XLong field) { - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitShortField(XShort field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitStringField(XString field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitBooleanArrayField(XBooleanArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Boolean value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitByteArrayField(XByteArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Byte value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitCharArrayField(XCharArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Character value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitClassArrayField(XClassArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final String className : field.getClassNames()) { - final JType type = CodeModelUtils.ref(codeModel, className); - array.param(type); - } - return use; - } - - public JAnnotationUse visitDoubleArrayField(XDoubleArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Double value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitEnumArrayField(XEnumArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Enum value : field.getValue()) { - - final JAnnotationValue annotationValue = new JAnnotationValue() { - public void generate(JFormatter f) { - f.t(codeModel.ref(value.getDeclaringClass())).p('.').p( - value.name()); - } - }; - - addParam(array, annotationValue); - } - return use; - } - - @SuppressWarnings("unchecked") - public void addParam(final JAnnotationArrayMember array, - JAnnotationValue annotationValue) { - try { - final Field values = JAnnotationArrayMember.class - .getDeclaredField("values"); - values.setAccessible(true); - ((List) values.get(array)) - .add(annotationValue); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - public JAnnotationUse visitFloatArrayField(XFloatArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Float value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitIntArrayField(XIntArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Integer value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitShortArrayField(XShortArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Short value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitStringArrayField(XStringArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final String value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationArrayField(XAnnotationArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - final XAnnotation[] annotations = field.getValue(); - for (final XAnnotation annotation : annotations) { - - final JAnnotationUse annotationUse = array.annotate(annotation - .getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - - annotation.accept(visitor); - - } - return use; - } - - public JAnnotationUse visitLongArrayField(XLongArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Long value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationField( - org.jvnet.annox.model.XAnnotationField.XAnnotation field) { - final JAnnotationUse annotationUse = use.annotationParam(field - .getName(), field.getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return field.getValue().accept(visitor); - } - - } - -} diff --git a/basics/tags/0.6.2/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.2/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 7f3c247c..00000000 --- a/basics/tags/0.6.2/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin \ No newline at end of file diff --git a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java b/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java deleted file mode 100644 index 0d06742d..00000000 --- a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface A { - long longField(); - - int intField(); - - short shortField(); - - char charField(); - - byte byteField(); - - double doubleField(); - - float floatField(); - - boolean booleanField(); - - String stringField(); - - E enumField(); - - Class classField(); - - B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java b/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java deleted file mode 100644 index 9f27a8d4..00000000 --- a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface B { - - long[] longArrayField(); - - int[] intArrayField(); - - short[] shortArrayField(); - - char[] charArrayField(); - - byte[] byteArrayField(); - - double[] doubleArrayField(); - - float[] floatArrayField(); - - boolean[] booleanArrayField(); - - String[] stringArrayField(); - - E[] enumArrayField(); - - Class[] classArrayField(); - - B.C[] annotationArrayField(); - - @Retention(RetentionPolicy.RUNTIME) - public static @interface C { - } -} \ No newline at end of file diff --git a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java b/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java deleted file mode 100644 index 4eae4782..00000000 --- a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface D { - -} diff --git a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java b/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java deleted file mode 100644 index f8e7b4e5..00000000 --- a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -public enum E { - - ONE, TWO, THREE, FOUR; - -} \ No newline at end of file diff --git a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java b/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java deleted file mode 100644 index fd8d8c21..00000000 --- a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface F { - String value(); - -} diff --git a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java b/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java deleted file mode 100644 index 106f53db..00000000 --- a/basics/tags/0.6.2/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.project.MavenProject; -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunPluginTest extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setProject(new MavenProject()); - mojo.setForceRegenerate(true); - mojo.setExtension(true); - - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } -} diff --git a/basics/tags/0.6.2/annotate/src/test/resources/schema.xsd b/basics/tags/0.6.2/annotate/src/test/resources/schema.xsd deleted file mode 100644 index 79a863a0..00000000 --- a/basics/tags/0.6.2/annotate/src/test/resources/schema.xsd +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/ant/.classpath b/basics/tags/0.6.2/ant/.classpath deleted file mode 100644 index 82dcdf3c..00000000 --- a/basics/tags/0.6.2/ant/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/basics/tags/0.6.2/ant/.project b/basics/tags/0.6.2/ant/.project deleted file mode 100644 index 41fdd059..00000000 --- a/basics/tags/0.6.2/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/ant/pom.xml b/basics/tags/0.6.2/ant/pom.xml deleted file mode 100644 index 19b4e476..00000000 --- a/basics/tags/0.6.2/ant/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.2/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.6.2/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.6.2/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.6.2/basic/.classpath b/basics/tags/0.6.2/basic/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.2/basic/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.2/basic/.project b/basics/tags/0.6.2/basic/.project deleted file mode 100644 index 2981ba9f..00000000 --- a/basics/tags/0.6.2/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/basic/pom.xml b/basics/tags/0.6.2/basic/pom.xml deleted file mode 100644 index 48fe1623..00000000 --- a/basics/tags/0.6.2/basic/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.6.2 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 5ebeb60a..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 51fefbea..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index 511cd361..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,337 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private Class copyStrategyClass = JAXBCopyStrategy.class; - - public void setCopyStrategyClass(final Class copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public Class getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, codeModel - .ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, codeModel - .ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl(JMod.FINAL, theClass.owner().ref( - Object.class), "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), JExpr - .invoke("createNewInstance"), target)); - } else { - body - ._if(JExpr._null().eq(target)) - ._then() - ._throw( - JExpr - ._new( - theClass - .owner() - .ref( - IllegalArgumentException.class)) - .arg( - "Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator).arg( - draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", JExpr - .cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr.invoke( - copyStrategy, "copy").arg( - theClass.owner().ref(LocatorUtils.class) - .staticInvoke("property").arg(locator) - .arg( - fieldOutline.getPropertyInfo() - .getName(false)).arg( - sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), copyFieldType - .isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 542d6255..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,255 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private Class equalsStrategyClass = JAXBEqualsStrategy.class; - - public void setEqualsStrategyClass( - Class equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public Class getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index ab419c7b..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,205 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private Class hashCodeStrategyClass = JAXBHashCodeStrategy.class; - - public void setHashCodeStrategyClass( - Class hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public Class getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, theClass - .owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass.owner() - .ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign(currentHashCode, hashCodeStrategy.invoke( - "hashCode").arg( - codeModel.ref(LocatorUtils.class).staticInvoke( - "property").arg(locator).arg( - fieldOutline.getPropertyInfo().getName( - false)).arg(theValue)).arg( - currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index da3dc67a..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,215 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline); - } - } - processPackageOutlines(outline); - return true; - } - - private void processClassOutline(ClassOutline classOutline) { - - generateExtends(classOutline); - generateImplements(classOutline); - - } - - private void processEnumOutline(EnumOutline enumOutline) { - - generateExtends(enumOutline); - generateImplements(enumOutline); - - } - - private void processElementOutline(ElementOutline elementOutline) { - - generateExtends(elementOutline); - generateImplements(elementOutline); - - } - - private void processPackageOutlines(Outline outline) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface); - } - } - } - } - } - } - } - } - - private void generateExtends(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(EnumOutline enumOutline) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(ElementOutline elementOutline) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization) - throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - generateExtends(theClass, extendsClass); - } - } - - private void generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass) { - if (extendsClass.getClassName() != null) { - final String name = extendsClass.getClassName(); - final JClass targetClass = theClass.owner().ref(name); - theClass._extends(targetClass); - } - } - - private void generateImplements(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(EnumOutline enumOutline) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(ElementOutline elementOutline) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations) - throws AssertionError { - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - generateImplements(theClass, implementsInterface); - } - } - } - - private void generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface) { - - if (implementsInterface.getInterfaceName() != null) { - final JClass targetClass = theClass.owner().ref( - implementsInterface.getInterfaceName()); - theClass._implements(targetClass); - } - } -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index 1eb76e35..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private Class mergeStrategyClass = JAXBMergeStrategy.class; - - public void setMergeStrategyClass( - final Class mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public Class getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index b0c69927..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(generatedSetter.body()); - accessor.fromRawValue(generatedSetter.body(), "draft", - value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index 80525091..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private Class toStringStrategyClass = JAXBToStringStrategy.class; - - public void setToStringStrategyClass( - Class toStringStrategy) { - if (!ToStringStrategy.class.isAssignableFrom(toStringStrategy)) - throw new IllegalArgumentException("The class must extend [" - + ToStringStrategy.class.getName() + "]."); - this.toStringStrategyClass = toStringStrategy; - } - - public Class getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 13d8fe6b..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final Class strategyClass) { - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index e84181a7..00000000 --- a/basics/tags/0.6.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - for (CClassInfo classInfo : model.beans().values()) { - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - - if (CustomizationUtils.containsCustomization( - classInfo, Customizations.LAX_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - - } else if (CustomizationUtils.containsCustomization( - classInfo, Customizations.SKIP_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - - } else if (CustomizationUtils.containsCustomization( - classInfo, Customizations.STRICT_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - - if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - - } else if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - - } else if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.2/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.2/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 1f990bc4..00000000 --- a/basics/tags/0.6.2/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,11 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin \ No newline at end of file diff --git a/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.6.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.6.2/basic/src/test/resources/schema.xsd b/basics/tags/0.6.2/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.6.2/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/build-1.5.bat b/basics/tags/0.6.2/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.2/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.2/build-1.6.bat b/basics/tags/0.6.2/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.2/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.2/deploy.bat b/basics/tags/0.6.2/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/tags/0.6.2/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/tags/0.6.2/dist/pom.xml b/basics/tags/0.6.2/dist/pom.xml deleted file mode 100644 index 06880c81..00000000 --- a/basics/tags/0.6.2/dist/pom.xml +++ /dev/null @@ -1,149 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - - diff --git a/basics/tags/0.6.2/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.6.2/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.6.2/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.2/dist/src/main/assembly/dist.xml b/basics/tags/0.6.2/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.6.2/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.2/install-1.5.bat b/basics/tags/0.6.2/install-1.5.bat deleted file mode 100644 index 24bfffb2..00000000 --- a/basics/tags/0.6.2/install-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.2/install-1.6.bat b/basics/tags/0.6.2/install-1.6.bat deleted file mode 100644 index cbb92aa4..00000000 --- a/basics/tags/0.6.2/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.2/install.bat b/basics/tags/0.6.2/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/tags/0.6.2/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/tags/0.6.2/jaxb/pom.xml b/basics/tags/0.6.2/jaxb/pom.xml deleted file mode 100644 index c8eaa654..00000000 --- a/basics/tags/0.6.2/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.4-1 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 3 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/jaxb/xjc/pom.xml b/basics/tags/0.6.2/jaxb/xjc/pom.xml deleted file mode 100644 index eee42e41..00000000 --- a/basics/tags/0.6.2/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.4-1 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.4 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/pom.xml b/basics/tags/0.6.2/pom.xml deleted file mode 100644 index 826c2dba..00000000 --- a/basics/tags/0.6.2/pom.xml +++ /dev/null @@ -1,346 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.6.2 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - - org.highsource.static.jaxb2-basics - ${sftp.static.highsource.org}/jaxb2-basics - - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/trunk - - - ant - runtime - tools - testing - basic - annotate - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - - 2.2.4-1 - 0.8.0 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - org.jvnet.annox - annox - 0.5.0 - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - ${jaxb.version} - - - - junit - junit - 3.8.1 - - - - commons-lang - commons-lang - 2.2 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.6.2/release.bat b/basics/tags/0.6.2/release.bat deleted file mode 100644 index 26f105db..00000000 --- a/basics/tags/0.6.2/release.bat +++ /dev/null @@ -1,5 +0,0 @@ -rem update versions -mvn clean install -Psamples -Ptests -mvn scm:tag -Dtag=%1 -mvn -Psamples -Ptests -DperformRelease -Psonatype-oss-release clean deploy -rem update versions \ No newline at end of file diff --git a/basics/tags/0.6.2/runtime/.classpath b/basics/tags/0.6.2/runtime/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.2/runtime/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.2/runtime/.project b/basics/tags/0.6.2/runtime/.project deleted file mode 100644 index e2a9acd9..00000000 --- a/basics/tags/0.6.2/runtime/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/runtime/pom.xml b/basics/tags/0.6.2/runtime/pom.xml deleted file mode 100644 index cd44cb49..00000000 --- a/basics/tags/0.6.2/runtime/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index 6a33cd15..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,295 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return ((Equals) lhs).equals(leftLocator, rightLocator, rhs, this); - } else { - return lhs.equals(rhs); - } - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index 2da953fe..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,240 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCode * iConstant - + ((HashCode) value).hashCode(locator, this); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index 2f2bb16a..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 1fcb3077..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 1cbe9fc2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - -// public Object[] getMessageParameters() { -// return new Object[] { getObject() }; -// } -// - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() - + ".messages")); - } - -// public int hashCode() { -// int hashCode = getObject().hashCode(); -// return hashCode; -// } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index f248db7e..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index d07a8eca..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index 76718546..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 578a20ef..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index b29bad1e..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MClassInfo getBaseTypeInfo(); - - public String getName(); - - public String getLocalName(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index eb91799e..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 8f896718..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 26947454..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 6afbd3b0..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index bc10b7c2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 7bf53eb7..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 318bb794..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor { - - public V visitList(MList info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - - public V visitClassInfo(MClassInfo info); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 85df90f2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index 637c8a68..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MClassInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MClassInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MClassInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index 45644f54..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - QName elementName, MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index d25eb09e..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 7a059903..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo { - - private final MEnumLeafInfoOrigin origin; - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index 8ab0bb5d..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,481 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - if (!list) { - return ti; - } else { - return new CMList(createListType(ti.getTargetType()), ti); - } - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - private MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()), - info.isElement() ? info.getElementName() : null); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract MPackageInfo getPackage(EI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - getTypeInfo(baseType), info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 9c4098be..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index 3a12e0d8..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,209 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 37af6535..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index a2a7eda3..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo { - - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index d2e65547..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index df1c16d2..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.6.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.6.2/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.6.2/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.6.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.6.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.6.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.6.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.6.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.6.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.6.2/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.6.2/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.6.2/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/annotate/pom.xml b/basics/tags/0.6.2/samples/annotate/pom.xml deleted file mode 100644 index b6515eec..00000000 --- a/basics/tags/0.6.2/samples/annotate/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate - pom - JAXB2 Basics - Sample [annotate] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.2 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - org.hibernate - hibernate-search - 3.0.0.GA - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/annotate/project-build.xml b/basics/tags/0.6.2/samples/annotate/project-build.xml deleted file mode 100644 index 7998d52b..00000000 --- a/basics/tags/0.6.2/samples/annotate/project-build.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/annotate/project-pom.xml b/basics/tags/0.6.2/samples/annotate/project-pom.xml deleted file mode 100644 index 1fe0f540..00000000 --- a/basics/tags/0.6.2/samples/annotate/project-pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate-maven - ${project.version} - jar - JAXB2 Basics - Sample [annotate-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - provided - - - org.hibernate - hibernate-search - 3.0.0.GA - provided - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - - - org.hibernate - hibernate-search - 3.0.0.GA - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.2/samples/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index 0a07b0ff..00000000 --- a/basics/tags/0.6.2/samples/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.2/samples/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.2/samples/annotate/src/main/resources/schema.xsd deleted file mode 100644 index d991150f..00000000 --- a/basics/tags/0.6.2/samples/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/basic/pom.xml b/basics/tags/0.6.2/samples/basic/pom.xml deleted file mode 100644 index 1c890385..00000000 --- a/basics/tags/0.6.2/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.2 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/basic/project-build.xml b/basics/tags/0.6.2/samples/basic/project-build.xml deleted file mode 100644 index 6fddf3b1..00000000 --- a/basics/tags/0.6.2/samples/basic/project-build.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/basic/project-pom.xml b/basics/tags/0.6.2/samples/basic/project-pom.xml deleted file mode 100644 index a77bfdcd..00000000 --- a/basics/tags/0.6.2/samples/basic/project-pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/basic/src/main/assembly/src.xml b/basics/tags/0.6.2/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.6.2/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.6.2/samples/basic/src/main/java/.placeholder b/basics/tags/0.6.2/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.2/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.6.2/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.2/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.2/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.6.2/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.2/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/basic/src/test/samples/1.xml b/basics/tags/0.6.2/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.2/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.2/samples/modular-ant/pom.xml b/basics/tags/0.6.2/samples/modular-ant/pom.xml deleted file mode 100644 index ea40f199..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.2 - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/modular-ant/project-build.xml b/basics/tags/0.6.2/samples/modular-ant/project-build.xml deleted file mode 100644 index c598b256..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.6.2/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.6.2/samples/modular-ant/src/main/java/.placeholder b/basics/tags/0.6.2/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.2/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.6.2/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.2/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.6.2/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.6.2/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.2/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.2/samples/po/pom.xml b/basics/tags/0.6.2/samples/po/pom.xml deleted file mode 100644 index f1f5fda6..00000000 --- a/basics/tags/0.6.2/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.2 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/po/project-build.xml b/basics/tags/0.6.2/samples/po/project-build.xml deleted file mode 100644 index 401deb52..00000000 --- a/basics/tags/0.6.2/samples/po/project-build.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/po/src/main/java/.placeholder b/basics/tags/0.6.2/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.2/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.6.2/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.6.2/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.2/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.6.2/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.6.2/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.6.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.2/samples/po/src/test/resources/log4j.properties b/basics/tags/0.6.2/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.2/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/po/src/test/samples/po.xml b/basics/tags/0.6.2/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.6.2/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/pom.xml b/basics/tags/0.6.2/samples/pom.xml deleted file mode 100644 index e17e45e4..00000000 --- a/basics/tags/0.6.2/samples/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - po - basic - modular-ant - annotate - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/samples - - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/samples/src/main/assembly/ant-src.xml b/basics/tags/0.6.2/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.6.2/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.6.2/samples/src/main/assembly/maven-src.xml b/basics/tags/0.6.2/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.6.2/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.6.2/testing/.classpath b/basics/tags/0.6.2/testing/.classpath deleted file mode 100644 index e27f6e53..00000000 --- a/basics/tags/0.6.2/testing/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.2/testing/.project b/basics/tags/0.6.2/testing/.project deleted file mode 100644 index 22b73ea9..00000000 --- a/basics/tags/0.6.2/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/testing/pom.xml b/basics/tags/0.6.2/testing/pom.xml deleted file mode 100644 index 8ec1aafe..00000000 --- a/basics/tags/0.6.2/testing/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.2/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.6.2/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.6.2/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.6.2/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.6.2/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.6.2/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.6.2/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.6.2/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.6.2/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.6.2/testing/src/test/samples/1.xml b/basics/tags/0.6.2/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/tags/0.6.2/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.6.2/testing/src/test/samples/2.xml b/basics/tags/0.6.2/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/tags/0.6.2/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/annotate/.classpath b/basics/tags/0.6.2/tests/annotate/.classpath deleted file mode 100644 index c42a02b2..00000000 --- a/basics/tags/0.6.2/tests/annotate/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.2/tests/annotate/.project b/basics/tags/0.6.2/tests/annotate/.project deleted file mode 100644 index 282d843f..00000000 --- a/basics/tags/0.6.2/tests/annotate/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/tests/annotate/pom.xml b/basics/tags/0.6.2/tests/annotate/pom.xml deleted file mode 100644 index aa2c7e36..00000000 --- a/basics/tags/0.6.2/tests/annotate/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.2 - ../pom.xml - - jaxb2-basics-test-annotate - jar - JAXB2 Basics - Test [annotate] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - -Xannotate-defaultFieldTarget=setter - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.2/tests/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.2/tests/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index dcffedbc..00000000 --- a/basics/tags/0.6.2/tests/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.2/tests/annotate/src/main/resources/schema.xsd deleted file mode 100644 index 7cb385ac..00000000 --- a/basics/tags/0.6.2/tests/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java b/basics/tags/0.6.2/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java deleted file mode 100644 index c59125b0..00000000 --- a/basics/tags/0.6.2/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.annotate; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunAnnotatePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } - -} diff --git a/basics/tags/0.6.2/tests/annox/.classpath b/basics/tags/0.6.2/tests/annox/.classpath deleted file mode 100644 index a225f00d..00000000 --- a/basics/tags/0.6.2/tests/annox/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/basics/tags/0.6.2/tests/annox/.project b/basics/tags/0.6.2/tests/annox/.project deleted file mode 100644 index 8686d22a..00000000 --- a/basics/tags/0.6.2/tests/annox/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/tests/annox/annotations/.classpath b/basics/tags/0.6.2/tests/annox/annotations/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.2/tests/annox/annotations/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.2/tests/annox/annotations/.project b/basics/tags/0.6.2/tests/annox/annotations/.project deleted file mode 100644 index 60d460cf..00000000 --- a/basics/tags/0.6.2/tests/annox/annotations/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox-annotations - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/tests/annox/annotations/pom.xml b/basics/tags/0.6.2/tests/annox/annotations/pom.xml deleted file mode 100644 index ad43fb33..00000000 --- a/basics/tags/0.6.2/tests/annox/annotations/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.2 - ../pom.xml - - jaxb2-basics-test-annox-annotations - jar - JAXB2 Basics - Test [annox-annotations] - diff --git a/basics/tags/0.6.2/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java b/basics/tags/0.6.2/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java deleted file mode 100644 index 8c21043b..00000000 --- a/basics/tags/0.6.2/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface Alpha { - long longField() default 1; - - int intField() default 2; - - short shortField() default 3; - - char charField() default 'f'; - - byte byteField() default 5; - - double doubleField() default 6.0; - - float floatField() default 7.0f; - - boolean booleanField() default true; - - Digits enumField() default Digits.EIGHT; - - String stringField() default "nine"; - - @SuppressWarnings("unchecked") - Class classField() default String.class; - - // B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java b/basics/tags/0.6.2/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java deleted file mode 100644 index a8b4e3e7..00000000 --- a/basics/tags/0.6.2/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -public enum Digits { - - ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE; - -} \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/annox/pom.xml b/basics/tags/0.6.2/tests/annox/pom.xml deleted file mode 100644 index 27636a54..00000000 --- a/basics/tags/0.6.2/tests/annox/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.2 - ../pom.xml - - jaxb2-basics-test-annox - pom - JAXB2 Basics - Test [annox] - - annotations - schema - - - diff --git a/basics/tags/0.6.2/tests/annox/schema/pom.xml b/basics/tags/0.6.2/tests/annox/schema/pom.xml deleted file mode 100644 index 8528de39..00000000 --- a/basics/tags/0.6.2/tests/annox/schema/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.2 - ../pom.xml - - jaxb2-basics-test-annox-schema - jar - JAXB2 Basics - Test [annox-schema] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/annox/schema/src/main/resources/binding.xjb b/basics/tags/0.6.2/tests/annox/schema/src/main/resources/binding.xjb deleted file mode 100644 index 71117799..00000000 --- a/basics/tags/0.6.2/tests/annox/schema/src/main/resources/binding.xjb +++ /dev/null @@ -1,20 +0,0 @@ - - - jaxb:extensionBindingPrefixes="annox" - - - - - - 0 - 3 - - - - - diff --git a/basics/tags/0.6.2/tests/annox/schema/src/main/resources/schema.xsd b/basics/tags/0.6.2/tests/annox/schema/src/main/resources/schema.xsd deleted file mode 100644 index 7408ec40..00000000 --- a/basics/tags/0.6.2/tests/annox/schema/src/main/resources/schema.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - 0 - 3 - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/build-1.5.bat b/basics/tags/0.6.2/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.2/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/build-1.6.bat b/basics/tags/0.6.2/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.2/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/episodes/a/pom.xml b/basics/tags/0.6.2/tests/episodes/a/pom.xml deleted file mode 100644 index aaa70b25..00000000 --- a/basics/tags/0.6.2/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.2 - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.6.2/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.2/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.6.2/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.6.2/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.2/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.6.2/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.6.2/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/episodes/b/pom.xml b/basics/tags/0.6.2/tests/episodes/b/pom.xml deleted file mode 100644 index d547c710..00000000 --- a/basics/tags/0.6.2/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.2 - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.6.2/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.2/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.6.2/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.6.2/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.6.2/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.6.2/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.2/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.6.2/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.6.2/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/episodes/pom.xml b/basics/tags/0.6.2/tests/episodes/pom.xml deleted file mode 100644 index 38e40d02..00000000 --- a/basics/tags/0.6.2/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.2 - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/ignoring/pom.xml b/basics/tags/0.6.2/tests/ignoring/pom.xml deleted file mode 100644 index 46400757..00000000 --- a/basics/tags/0.6.2/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.2 - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.2/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.6.2/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.6.2/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/issues/.classpath b/basics/tags/0.6.2/tests/issues/.classpath deleted file mode 100644 index 8f134b1c..00000000 --- a/basics/tags/0.6.2/tests/issues/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.2/tests/issues/.project b/basics/tags/0.6.2/tests/issues/.project deleted file mode 100644 index d98a2c30..00000000 --- a/basics/tags/0.6.2/tests/issues/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/tests/issues/pom.xml b/basics/tags/0.6.2/tests/issues/pom.xml deleted file mode 100644 index 016018d2..00000000 --- a/basics/tags/0.6.2/tests/issues/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.2 - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - -Xsetters - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.6.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.6.2/tests/issues/src/main/resources/binding.xjb b/basics/tags/0.6.2/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 0b94cec6..00000000 --- a/basics/tags/0.6.2/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,17 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - diff --git a/basics/tags/0.6.2/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.6.2/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 38610c58..00000000 --- a/basics/tags/0.6.2/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 88bf03d0..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args - .add("-XautoInheritance-globalElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args - .add("-XautoInheritance-globalElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args - .add("-XautoInheritance-globalElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - - return args; - } - -} diff --git a/basics/tags/0.6.2/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.6.2/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.6.2/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/one/.classpath b/basics/tags/0.6.2/tests/one/.classpath deleted file mode 100644 index c42a02b2..00000000 --- a/basics/tags/0.6.2/tests/one/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.2/tests/one/.project b/basics/tags/0.6.2/tests/one/.project deleted file mode 100644 index fb3eacf0..00000000 --- a/basics/tags/0.6.2/tests/one/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/tests/one/pom.xml b/basics/tags/0.6.2/tests/one/pom.xml deleted file mode 100644 index 71e60bf2..00000000 --- a/basics/tags/0.6.2/tests/one/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.2 - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.2/tests/one/src/main/resources/schema.xsd b/basics/tags/0.6.2/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index 01a8c31b..00000000 --- a/basics/tags/0.6.2/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.6.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.2/tests/one/src/test/resources/log4j.properties b/basics/tags/0.6.2/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.2/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/one/src/test/samples/1.xml b/basics/tags/0.6.2/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.2/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.2/tests/one/src/test/samples/2.xml b/basics/tags/0.6.2/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.6.2/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.6.2/tests/pom.xml b/basics/tags/0.6.2/tests/pom.xml deleted file mode 100644 index a45214e7..00000000 --- a/basics/tags/0.6.2/tests/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - annotate - annox - episodes - one - issues - zj - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/samples - - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - - generate - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/zj/pom.xml b/basics/tags/0.6.2/tests/zj/pom.xml deleted file mode 100644 index 82dee199..00000000 --- a/basics/tags/0.6.2/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.2 - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.2/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.6.2/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.6.2/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.6.2/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.6.2/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.2/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.6.2/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.2/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.2/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.6.2/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.6.2/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.6.2/tools/.classpath b/basics/tags/0.6.2/tools/.classpath deleted file mode 100644 index 24166ba5..00000000 --- a/basics/tags/0.6.2/tools/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/basics/tags/0.6.2/tools/.project b/basics/tags/0.6.2/tools/.project deleted file mode 100644 index 89093281..00000000 --- a/basics/tags/0.6.2/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.2/tools/pom.xml b/basics/tags/0.6.2/tools/pom.xml deleted file mode 100644 index a97c25f3..00000000 --- a/basics/tags/0.6.2/tools/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.2 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - commons-lang - commons-lang - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index 4fea93c7..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!StringUtils.isEmpty(namespaceURI)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d4ca11b5..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 7a749a79..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,600 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations(Outline outline, - QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(CElementInfo elementInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index bb81f031..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index a7e6b211..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = parent.getParent().getClassOutline( - classInfo.getBaseTypeInfo()); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 16f45c22..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 9535bcaa..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 59cda4e0..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index 2e6d3fa8..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - generateClassOutline(modelOutline, modelInfo, - classInfo.getBaseTypeInfo()); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index ee45b6b0..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index e43958e1..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 41dcc73f..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - public XJCCMInfoFactory(Model model) { - super(model); - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - private final Map packages = new HashMap(); - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 946ab670..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index f855af96..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index 7d59132d..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 4414b8ae..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 0c5e02a0..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index 7f414d27..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 70f7489d..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index d98988d0..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index b6673c80..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index b7df6bbe..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 1d3a1f57..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 517cbb27..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index ef8a2639..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index 5d7c77a2..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c632055a..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 7cd5160b..00000000 --- a/basics/tags/0.6.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/tags/0.6.2/update-all-versions.bat b/basics/tags/0.6.2/update-all-versions.bat deleted file mode 100644 index f8e2a12d..00000000 --- a/basics/tags/0.6.2/update-all-versions.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -call update-versions %cd% %1 %2 \ No newline at end of file diff --git a/basics/tags/0.6.2/update-version.bat b/basics/tags/0.6.2/update-version.bat deleted file mode 100644 index 8a52b653..00000000 --- a/basics/tags/0.6.2/update-version.bat +++ /dev/null @@ -1,3 +0,0 @@ -sed "s/%2/%3/g" %1 > %1.tmp -del %1 -move %1.tmp %1 \ No newline at end of file diff --git a/basics/tags/0.6.2/update-versions.bat b/basics/tags/0.6.2/update-versions.bat deleted file mode 100644 index 1499b4f4..00000000 --- a/basics/tags/0.6.2/update-versions.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -for /R %1 %%x in (pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.classpath) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.tomcatplugin) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-build.xml) do if exist %%x call update-version %%x %2 %3 diff --git a/basics/tags/0.6.3/annotate/.classpath b/basics/tags/0.6.3/annotate/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.3/annotate/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.3/annotate/.project b/basics/tags/0.6.3/annotate/.project deleted file mode 100644 index 10d88fcb..00000000 --- a/basics/tags/0.6.3/annotate/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/annotate/pom.xml b/basics/tags/0.6.3/annotate/pom.xml deleted file mode 100644 index 4d91da09..00000000 --- a/basics/tags/0.6.3/annotate/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - jar - JAXB2 Basics - Annotate Plugin - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - commons-lang - commons-lang - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - org.jvnet.annox - annox - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.3/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java b/basics/tags/0.6.3/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java deleted file mode 100644 index 9678b232..00000000 --- a/basics/tags/0.6.3/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java +++ /dev/null @@ -1,409 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.annox.Constants; -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.parser.XAnnotationParser; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorUtils; -import org.jvnet.jaxb2_commons.util.OutlineUtils; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AnnotatePlugin extends AbstractParameterizablePlugin { - - private static final QName ANNOTATE_PROPERTY_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateProperty"); - private static final QName ANNOTATE_CLASS_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateClass"); - private static final QName ANNOTATE_ELEMENT_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateElement"); - private static final QName ANNOTATE_ENUM_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateEnum"); - private static final QName ANNOTATE_ENUM_CONSTANT_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateEnumConstant"); - private static final QName ANNOTATE_QNAME = new QName( - Constants.NAMESPACE_URI, "annotate"); - - @Override - public String getOptionName() { - return "Xannotate"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private String defaultFieldTarget = "getter"; - - public String getDefaultFieldTarget() { - return defaultFieldTarget; - } - - public void setDefaultFieldTarget(String defaultFieldTarget) { - if ("getter".equals(defaultFieldTarget) - || "setter".equals(defaultFieldTarget) - || "setter-parameter".equals(defaultFieldTarget) - || "field".equals(defaultFieldTarget)) { - this.defaultFieldTarget = defaultFieldTarget; - } else { - throw new IllegalArgumentException("Invalid default field target."); - } - } - - private XAnnotationParser annotationParser = XAnnotationParser.GENERIC; - - public XAnnotationParser getAnnotationParser() { - return annotationParser; - } - - public void setAnnotationParser(XAnnotationParser annotationParser) { - this.annotationParser = annotationParser; - } - - private Annotator annotator = new Annotator(); - - public Annotator getAnnotator() { - return annotator; - } - - public void setAnnotator(Annotator annotator) { - this.annotator = annotator; - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) { - - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, options, errorHandler); - } - } - - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, options, errorHandler); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, options, errorHandler); - } - return true; - } - - protected void processElementOutline(ElementOutline elementOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - - annotateElementOutline(elementOutline.implClass.owner(), - elementOutline, customizations, errorHandler); - } - - protected void processEnumOutline(EnumOutline enumOutline, Options options, - ErrorHandler errorHandler) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumOutline); - annotateEnumOutline(enumOutline.clazz.owner(), enumOutline, - customizations, errorHandler); - - for (final EnumConstantOutline enumConstantOutline : enumOutline.constants) { - processEnumConstantOutline(enumOutline, enumConstantOutline, - options, errorHandler); - } - - } - - protected void processClassOutline(ClassOutline classOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - - annotateClassOutline(classOutline.ref.owner(), classOutline, - customizations, errorHandler); - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - processFieldOutline(classOutline, fieldOutline, options, - errorHandler); - } - - } - - private void processFieldOutline(ClassOutline classOutline, - FieldOutline fieldOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - annotate(fieldOutline.parent().ref.owner(), fieldOutline, - customizations, errorHandler); - } - - private void processEnumConstantOutline(EnumOutline enumOutline, - EnumConstantOutline enumConstantOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumConstantOutline); - - annotateEnumConstantOutline(enumOutline.parent().getCodeModel(), - enumConstantOutline, customizations, errorHandler); - } - - protected void annotateElementOutline(final JCodeModel codeModel, - final ElementOutline elementOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ELEMENT_QNAME.equals(name)) { - - final JAnnotatable annotatable = elementOutline.implClass; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotateEnumOutline(final JCodeModel codeModel, - final EnumOutline enumOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ENUM_QNAME.equals(name)) { - - final JAnnotatable annotatable = enumOutline.clazz; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotateEnumConstantOutline(final JCodeModel codeModel, - final EnumConstantOutline enumConstantOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ENUM_CONSTANT_QNAME.equals(name)) { - - final JAnnotatable annotatable = enumConstantOutline.constRef; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - - } - } - } - } - - protected void annotateClassOutline(final JCodeModel codeModel, - final ClassOutline classOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - - customization.markAsAcknowledged(); - if (ANNOTATE_CLASS_QNAME.equals(name) - || ANNOTATE_QNAME.equals(name)) { - - final JAnnotatable annotatable = classOutline.ref; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotate(final JCodeModel codeModel, - final FieldOutline fieldOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_PROPERTY_QNAME.equals(name)) { - - final JAnnotatable annotatable; - - final String draftTarget = element.getAttribute("target"); - - final String target; - - if (draftTarget == null || "".equals(draftTarget)) { - target = getDefaultFieldTarget(); - } else { - target = draftTarget; - } - - if ("class".equals(target)) { - annotatable = fieldOutline.parent().ref; - } else if ("getter".equals(target)) { - final JMethod _getter = FieldAccessorUtils - .getter(fieldOutline); - if (_getter == null) { - logger.error(MessageFormat - .format("Could not annotate the getter of the field outline [{0}], getter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - - } - annotatable = _getter; - } else if ("setter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - if (_setter == null) { - logger.error(MessageFormat - .format("Could not annotate the setter of the field outline [{0}], setter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - } - annotatable = _setter; - } else if ("setter-parameter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - - if (_setter == null) { - logger.error(MessageFormat - .format("Could not annotate the setter parameter of the field outline [{0}], setter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - annotatable = null; - } else { - final JVar[] params = _setter.listParams(); - if (params.length != 1) { - logger.error(MessageFormat - .format("Could not annotate the setter parameter of the field outline [{0}], setter method must have a single parameter(this setter has {1}).", - - OutlineUtils - .getFieldName(fieldOutline), - params.length)); - annotatable = null; - } else { - annotatable = FieldAccessorUtils.setter( - fieldOutline).listParams()[0]; - } - } - } else if ("field".equals(target)) { - // Ok - final JFieldVar _field = FieldAccessorUtils - .field(fieldOutline); - if (_field == null) { - logger.error(MessageFormat - .format("Could not annotate the field of the field outline [{0}] since it could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - } - annotatable = _field; - - } else { - logger.error("Invalid annotation target [" + target - + "]."); - annotatable = null; - } - - if (annotatable != null) { - - annotate(codeModel, errorHandler, customization, - element, annotatable); - } - } - } - } - } - - private void annotate(final JCodeModel codeModel, - ErrorHandler errorHandler, - final CPluginCustomization customization, final Element element, - final JAnnotatable annotatable) { - final NodeList elements = element.getChildNodes(); - for (int index = 0; index < elements.getLength(); index++) { - final Node node = elements.item(index); - if (node.getNodeType() == Node.ELEMENT_NODE) { - final Element child = (Element) node; - - try { - final XAnnotation annotation = getAnnotationParser().parse( - child); - getAnnotator().annotate(codeModel, annotatable, annotation); - } catch (Exception ex) { - try { - errorHandler.error(new SAXParseException( - "Error parsing annotation.", - customization.locator, ex)); - } catch (SAXException ignored) { - // Nothing to do - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(ANNOTATE_QNAME, ANNOTATE_CLASS_QNAME, - ANNOTATE_ELEMENT_QNAME, ANNOTATE_PROPERTY_QNAME); - } - -} diff --git a/basics/tags/0.6.3/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java b/basics/tags/0.6.3/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java deleted file mode 100644 index 2eacc503..00000000 --- a/basics/tags/0.6.3/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java +++ /dev/null @@ -1,314 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.lang.reflect.Field; -import java.util.Collection; -import java.util.List; - -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.model.XAnnotationField; -import org.jvnet.annox.model.XAnnotationField.XAnnotationArray; -import org.jvnet.annox.model.XAnnotationField.XBoolean; -import org.jvnet.annox.model.XAnnotationField.XBooleanArray; -import org.jvnet.annox.model.XAnnotationField.XByte; -import org.jvnet.annox.model.XAnnotationField.XByteArray; -import org.jvnet.annox.model.XAnnotationField.XChar; -import org.jvnet.annox.model.XAnnotationField.XCharArray; -import org.jvnet.annox.model.XAnnotationField.XClass; -import org.jvnet.annox.model.XAnnotationField.XClassArray; -import org.jvnet.annox.model.XAnnotationField.XDouble; -import org.jvnet.annox.model.XAnnotationField.XDoubleArray; -import org.jvnet.annox.model.XAnnotationField.XEnum; -import org.jvnet.annox.model.XAnnotationField.XEnumArray; -import org.jvnet.annox.model.XAnnotationField.XFloat; -import org.jvnet.annox.model.XAnnotationField.XFloatArray; -import org.jvnet.annox.model.XAnnotationField.XInt; -import org.jvnet.annox.model.XAnnotationField.XIntArray; -import org.jvnet.annox.model.XAnnotationField.XLong; -import org.jvnet.annox.model.XAnnotationField.XLongArray; -import org.jvnet.annox.model.XAnnotationField.XShort; -import org.jvnet.annox.model.XAnnotationField.XShortArray; -import org.jvnet.annox.model.XAnnotationField.XString; -import org.jvnet.annox.model.XAnnotationField.XStringArray; -import org.jvnet.annox.model.XAnnotationVisitor; -import org.jvnet.jaxb2_commons.util.CodeModelUtils; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationArrayMember; -import com.sun.codemodel.JAnnotationUse; -import com.sun.codemodel.JAnnotationValue; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFormatter; -import com.sun.codemodel.JType; - -public class Annotator { - - public static final Annotator INSTANCE = new Annotator(); - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - Collection xannotations) { - for (final XAnnotation xannotation : xannotations) { - if (xannotation != null) { - annotate(codeModel, annotatable, xannotation); - } - } - } - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - XAnnotation xannotation) { - final JClass annotationClass = codeModel.ref(xannotation - .getAnnotationClass()); - JAnnotationUse annotationUse = null; - for (JAnnotationUse annotation : annotatable.annotations()) { - if (annotationClass.equals(annotation.getAnnotationClass())) { - annotationUse = annotation; - } - } - if (annotationUse == null) { - annotationUse = annotatable.annotate(annotationClass); - } - final XAnnotationVisitor visitor = createAnnotationFieldVisitor( - codeModel, annotationUse); - xannotation.accept(visitor); - - } - - protected XAnnotationVisitor createAnnotationFieldVisitor( - JCodeModel codeModel, final JAnnotationUse annotationUse) { - final XAnnotationVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return visitor; - } - - public static class AnnotatingFieldVisitor implements - XAnnotationVisitor { - - protected final JCodeModel codeModel; - - protected final JAnnotationUse use; - - public AnnotatingFieldVisitor(final JCodeModel codeModel, - final JAnnotationUse use) { - this.codeModel = codeModel; - this.use = use; - } - - public JAnnotationUse visitAnnotation(XAnnotation annotation) { - for (final XAnnotationField field : annotation.getFieldsList()) { - field.accept(this); - } - return use; - } - - public JAnnotationUse visitBooleanField(XBoolean field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitByteField(XByte field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitCharField(XChar field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitClassField(XClass field) { - JType type = CodeModelUtils.ref(codeModel, field.getClassName()); - return use.param(field.getName(), type); - } - - public JAnnotationUse visitDoubleField(XDouble field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitEnumField(XEnum field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitFloatField(XFloat field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitIntField(XInt field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitLongField(XLong field) { - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitShortField(XShort field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitStringField(XString field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitBooleanArrayField(XBooleanArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Boolean value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitByteArrayField(XByteArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Byte value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitCharArrayField(XCharArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Character value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitClassArrayField(XClassArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final String className : field.getClassNames()) { - final JType type = CodeModelUtils.ref(codeModel, className); - array.param(type); - } - return use; - } - - public JAnnotationUse visitDoubleArrayField(XDoubleArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Double value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitEnumArrayField(XEnumArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Enum value : field.getValue()) { - - final JAnnotationValue annotationValue = new JAnnotationValue() { - public void generate(JFormatter f) { - f.t(codeModel.ref(value.getDeclaringClass())).p('.') - .p(value.name()); - } - }; - - addParam(array, annotationValue); - } - return use; - } - - @SuppressWarnings("unchecked") - public void addParam(final JAnnotationArrayMember array, - JAnnotationValue annotationValue) { - try { - final Field values = JAnnotationArrayMember.class - .getDeclaredField("values"); - values.setAccessible(true); - ((List) values.get(array)) - .add(annotationValue); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - public JAnnotationUse visitFloatArrayField(XFloatArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Float value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitIntArrayField(XIntArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Integer value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitShortArrayField(XShortArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Short value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitStringArrayField(XStringArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final String value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationArrayField(XAnnotationArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - final XAnnotation[] annotations = field.getValue(); - for (final XAnnotation annotation : annotations) { - - final JAnnotationUse annotationUse = array.annotate(annotation - .getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - - annotation.accept(visitor); - - } - return use; - } - - public JAnnotationUse visitLongArrayField(XLongArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Long value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationField( - org.jvnet.annox.model.XAnnotationField.XAnnotation field) { - final JAnnotationUse annotationUse = use.annotationParam( - field.getName(), field.getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return field.getValue().accept(visitor); - } - - } - -} diff --git a/basics/tags/0.6.3/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.3/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 7f3c247c..00000000 --- a/basics/tags/0.6.3/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin \ No newline at end of file diff --git a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java b/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java deleted file mode 100644 index 0d06742d..00000000 --- a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface A { - long longField(); - - int intField(); - - short shortField(); - - char charField(); - - byte byteField(); - - double doubleField(); - - float floatField(); - - boolean booleanField(); - - String stringField(); - - E enumField(); - - Class classField(); - - B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java b/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java deleted file mode 100644 index 9f27a8d4..00000000 --- a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface B { - - long[] longArrayField(); - - int[] intArrayField(); - - short[] shortArrayField(); - - char[] charArrayField(); - - byte[] byteArrayField(); - - double[] doubleArrayField(); - - float[] floatArrayField(); - - boolean[] booleanArrayField(); - - String[] stringArrayField(); - - E[] enumArrayField(); - - Class[] classArrayField(); - - B.C[] annotationArrayField(); - - @Retention(RetentionPolicy.RUNTIME) - public static @interface C { - } -} \ No newline at end of file diff --git a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java b/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java deleted file mode 100644 index 4eae4782..00000000 --- a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface D { - -} diff --git a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java b/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java deleted file mode 100644 index f8e7b4e5..00000000 --- a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -public enum E { - - ONE, TWO, THREE, FOUR; - -} \ No newline at end of file diff --git a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java b/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java deleted file mode 100644 index fd8d8c21..00000000 --- a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface F { - String value(); - -} diff --git a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java b/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java deleted file mode 100644 index 106f53db..00000000 --- a/basics/tags/0.6.3/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.project.MavenProject; -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunPluginTest extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setProject(new MavenProject()); - mojo.setForceRegenerate(true); - mojo.setExtension(true); - - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } -} diff --git a/basics/tags/0.6.3/annotate/src/test/resources/schema.xsd b/basics/tags/0.6.3/annotate/src/test/resources/schema.xsd deleted file mode 100644 index 79a863a0..00000000 --- a/basics/tags/0.6.3/annotate/src/test/resources/schema.xsd +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/ant/.classpath b/basics/tags/0.6.3/ant/.classpath deleted file mode 100644 index 82dcdf3c..00000000 --- a/basics/tags/0.6.3/ant/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/basics/tags/0.6.3/ant/.project b/basics/tags/0.6.3/ant/.project deleted file mode 100644 index 41fdd059..00000000 --- a/basics/tags/0.6.3/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/ant/pom.xml b/basics/tags/0.6.3/ant/pom.xml deleted file mode 100644 index 6c746bea..00000000 --- a/basics/tags/0.6.3/ant/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.3/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.6.3/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.6.3/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.6.3/basic/.classpath b/basics/tags/0.6.3/basic/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.3/basic/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.3/basic/.project b/basics/tags/0.6.3/basic/.project deleted file mode 100644 index 2981ba9f..00000000 --- a/basics/tags/0.6.3/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/basic/pom.xml b/basics/tags/0.6.3/basic/pom.xml deleted file mode 100644 index b1624b64..00000000 --- a/basics/tags/0.6.3/basic/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.6.3 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 5ebeb60a..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 51fefbea..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index 78a9987f..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,337 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String copyStrategyClass = JAXBCopyStrategy.class.getName(); - - public void setCopyStrategyClass(final String copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public String getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, codeModel - .ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, codeModel - .ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl(JMod.FINAL, theClass.owner().ref( - Object.class), "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), JExpr - .invoke("createNewInstance"), target)); - } else { - body - ._if(JExpr._null().eq(target)) - ._then() - ._throw( - JExpr - ._new( - theClass - .owner() - .ref( - IllegalArgumentException.class)) - .arg( - "Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator).arg( - draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", JExpr - .cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr.invoke( - copyStrategy, "copy").arg( - theClass.owner().ref(LocatorUtils.class) - .staticInvoke("property").arg(locator) - .arg( - fieldOutline.getPropertyInfo() - .getName(false)).arg( - sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), copyFieldType - .isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 80290ee1..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,255 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); - - public void setEqualsStrategyClass( - String equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public String getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index 09302f0b..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,205 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); - - public void setHashCodeStrategyClass( - String hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public String getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, theClass - .owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass.owner() - .ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign(currentHashCode, hashCodeStrategy.invoke( - "hashCode").arg( - codeModel.ref(LocatorUtils.class).staticInvoke( - "property").arg(locator).arg( - fieldOutline.getPropertyInfo().getName( - false)).arg(theValue)).arg( - currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index da3dc67a..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,215 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline); - } - } - processPackageOutlines(outline); - return true; - } - - private void processClassOutline(ClassOutline classOutline) { - - generateExtends(classOutline); - generateImplements(classOutline); - - } - - private void processEnumOutline(EnumOutline enumOutline) { - - generateExtends(enumOutline); - generateImplements(enumOutline); - - } - - private void processElementOutline(ElementOutline elementOutline) { - - generateExtends(elementOutline); - generateImplements(elementOutline); - - } - - private void processPackageOutlines(Outline outline) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface); - } - } - } - } - } - } - } - } - - private void generateExtends(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(EnumOutline enumOutline) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(ElementOutline elementOutline) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization) - throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - generateExtends(theClass, extendsClass); - } - } - - private void generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass) { - if (extendsClass.getClassName() != null) { - final String name = extendsClass.getClassName(); - final JClass targetClass = theClass.owner().ref(name); - theClass._extends(targetClass); - } - } - - private void generateImplements(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(EnumOutline enumOutline) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(ElementOutline elementOutline) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations) - throws AssertionError { - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - generateImplements(theClass, implementsInterface); - } - } - } - - private void generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface) { - - if (implementsInterface.getInterfaceName() != null) { - final JClass targetClass = theClass.owner().ref( - implementsInterface.getInterfaceName()); - theClass._implements(targetClass); - } - } -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index c83e1901..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); - - public void setMergeStrategyClass( - final String mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public String getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index d94d6a45..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - public static enum Mode { - - accessor { - - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(setter.body()); - accessor.fromRawValue(setter.body(), "draft", value); - } - }, - direct { - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - - final JFieldVar field = theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - - if (field != null) { - setter.body().assign(JExpr._this().ref(field), value); - } else { - // Fallback to the accessor - Mode.accessor.generateSetter(fieldOutline, theClass, - setter, value); - } - } - }; - public abstract void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value); - } - - private Mode mode = Mode.accessor; - - public String getMode() { - return mode.name(); - - } - - public void setMode(String mode) { - Validate.notNull(mode); - try { - this.mode = Mode.valueOf(mode); - } catch (IllegalArgumentException iaex) { - throw new IllegalArgumentException( - "Unsupported mode [" - + mode - + "]." - + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" - + " and [direct] (assigns the value to the field directly)."); - } - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - - mode.generateSetter(fieldOutline, theClass, - generatedSetter, value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java deleted file mode 100644 index 783cf37b..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - - public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-element-property"); - - public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-reference-property"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java deleted file mode 100644 index 97de9dd7..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeRef; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.ID; - -public class SimplifyPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xsimplify"; - } - - @Override - public String getUsage() { - return "This plugin allows simplifying \"complex\" properties" - + " (ex. aOrBOrC generated from repeatable choices)" - + " into several \"simple\" properties (ex. a, b, c).\n" - + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" - + " for plugin documentation."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public void postProcessModel(final Model model, ErrorHandler errorHandler) { - - for (final CClassInfo classInfo : model.beans().values()) { - postProcessClassInfo(model, classInfo); - } - } - - private void postProcessClassInfo(final Model model, - final CClassInfo classInfo) { - final List properties = new ArrayList( - classInfo.getProperties()); - for (CPropertyInfo property : properties) { - property.accept(new CPropertyVisitor() { - - public Void onElement(CElementPropertyInfo elementProperty) { - postProcessElementPropertyInfo(model, classInfo, - elementProperty); - return null; - } - - public Void onAttribute(CAttributePropertyInfo attributeProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onValue(CValuePropertyInfo valueProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onReference(CReferencePropertyInfo p) { - postProcessReferencePropertyInfo(model, classInfo, p); - return null; - } - - }); - } - } - - private void postProcessElementPropertyInfo(final Model model, - final CClassInfo classInfo, CElementPropertyInfo property) { - if (property.isCollection() && property.getTypes().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyElementPropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } - } - } - - private void postProcessReferencePropertyInfo(final Model model, - final CClassInfo classInfo, CReferencePropertyInfo property) { - if (property.isCollection() && property.getElements().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } else if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsReferencePropertyInfo(model, - classInfo, property); - } - } - } - - private void simplifyElementPropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CElementPropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CTypeRef typeRef : property.getTypes()) { - final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( - model, property, typeRef); - classInfo.getProperties().add(index++, elementPropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsReferencePropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( - model, property, element); - classInfo.getProperties().add(index++, referencePropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CElementPropertyInfo elementPropertyInfo; - if (element instanceof CElementInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CElementInfo) element); - } else if (element instanceof CClassInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CClassInfo) element); - - } else if (element instanceof CClassRef) { - // elementPropertyInfo = createElementPropertyInfo(model, - // element, - // (CClassRef) element); - elementPropertyInfo = null; - // TODO WARN - - } else { - // TODO WARN - elementPropertyInfo = null; - } - if (elementPropertyInfo != null) { - classInfo.getProperties().add(index++, elementPropertyInfo); - } - } - classInfo.getProperties().remove(property); - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CElementInfo elementInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(elementInfo.getContentType(), element - .getElementName(), elementInfo.getContentType() - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CClassInfo classInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(classInfo, element.getElementName(), classInfo - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - // private CElementPropertyInfo createElementPropertyInfo(final Model model, - // CElement element, final CClassRef cr) { - // final CElementPropertyInfo elementPropertyInfo; - // final String propertyName = createPropertyName(model, element); - // elementPropertyInfo = new CElementPropertyInfo(propertyName, - // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - // element.getSchemaComponent(), element.getCustomizations(), - // element.getLocator(), false); - // elementPropertyInfo.getTypes().add( - // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), - // false, null)); - // return elementPropertyInfo; - // } - - private CReferencePropertyInfo createReferencePropertyInfo( - final Model model, CReferencePropertyInfo property, CElement element) { - final String propertyName = createPropertyName(model, element); - final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( - propertyName, true, false, property.isMixed(), - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), property.isDummy(), property.isContent(), - property.isMixedExtendedCust()); - referencePropertyInfo.getElements().add(element); - return referencePropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElementPropertyInfo property, CTypeRef typeRef) { - final String propertyName = createPropertyName(model, typeRef); - boolean required = false; - final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( - propertyName, CollectionMode.REPEATED_ELEMENT, typeRef - .getTarget().idUse(), typeRef.getTarget() - .getExpectedMimeType(), property.getSchemaComponent(), - property.getCustomizations(), property.getLocator(), required); - elementPropertyInfo.getTypes().add(typeRef); - return elementPropertyInfo; - } - - private String createPropertyName(final Model model, CElement element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getElementName().getLocalPart()); - return propertyName; - } - - private String createPropertyName(final Model model, CTypeRef element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getTagName().getLocalPart()); - return propertyName; - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index dc8eac3c..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); - - public void setToStringStrategyClass( - String toStringStrategy) { - this.toStringStrategyClass = toStringStrategy; - } - - public String getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 6f95d0b1..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final String strategyClassName) { - - try { - final Class strategyClass = Class.forName(strategyClassName); - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } catch (ClassNotFoundException cnfex) { - final JClass strategyJClass = codeModel.ref(strategyClassName); - return JExpr._new(strategyJClass); - } - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index e84181a7..00000000 --- a/basics/tags/0.6.3/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - for (CClassInfo classInfo : model.beans().values()) { - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - - if (CustomizationUtils.containsCustomization( - classInfo, Customizations.LAX_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - - } else if (CustomizationUtils.containsCustomization( - classInfo, Customizations.SKIP_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - - } else if (CustomizationUtils.containsCustomization( - classInfo, Customizations.STRICT_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - - if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - - } else if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - - } else if (CustomizationUtils.containsCustomization( - referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME)) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.3/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.3/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 679f6468..00000000 --- a/basics/tags/0.6.3/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,12 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin -org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin \ No newline at end of file diff --git a/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.6.3/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.6.3/basic/src/test/resources/schema.xsd b/basics/tags/0.6.3/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.6.3/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/build-1.5.bat b/basics/tags/0.6.3/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.3/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.3/build-1.6.bat b/basics/tags/0.6.3/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.3/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.3/deploy.bat b/basics/tags/0.6.3/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/tags/0.6.3/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/tags/0.6.3/dist/pom.xml b/basics/tags/0.6.3/dist/pom.xml deleted file mode 100644 index 3d5e8591..00000000 --- a/basics/tags/0.6.3/dist/pom.xml +++ /dev/null @@ -1,164 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/dist - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - - diff --git a/basics/tags/0.6.3/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.6.3/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.6.3/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.3/dist/src/main/assembly/dist.xml b/basics/tags/0.6.3/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.6.3/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.3/install-1.5.bat b/basics/tags/0.6.3/install-1.5.bat deleted file mode 100644 index 24bfffb2..00000000 --- a/basics/tags/0.6.3/install-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.3/install-1.6.bat b/basics/tags/0.6.3/install-1.6.bat deleted file mode 100644 index cbb92aa4..00000000 --- a/basics/tags/0.6.3/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.3/install.bat b/basics/tags/0.6.3/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/tags/0.6.3/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/tags/0.6.3/jaxb/pom.xml b/basics/tags/0.6.3/jaxb/pom.xml deleted file mode 100644 index c8eaa654..00000000 --- a/basics/tags/0.6.3/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.4-1 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 3 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/jaxb/release.bat b/basics/tags/0.6.3/jaxb/release.bat deleted file mode 100644 index e6784200..00000000 --- a/basics/tags/0.6.3/jaxb/release.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn clean deploy -DperformRelease=true -Psonatype-oss-release \ No newline at end of file diff --git a/basics/tags/0.6.3/jaxb/xjc/pom.xml b/basics/tags/0.6.3/jaxb/xjc/pom.xml deleted file mode 100644 index eee42e41..00000000 --- a/basics/tags/0.6.3/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.4-1 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.4 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/pom.xml b/basics/tags/0.6.3/pom.xml deleted file mode 100644 index 81414821..00000000 --- a/basics/tags/0.6.3/pom.xml +++ /dev/null @@ -1,362 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.6.3 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - org.highsource.static.jaxb2-basics - ${sftp.static.highsource.org}/jaxb2-basics - - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/trunk - - - ant - runtime - tools - testing - basic - annotate - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - dist - - - dist - - - - dist - - - - - 2.2.4-1 - 0.8.0 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - org.jvnet.annox - annox - 0.5.0 - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - ${jaxb.version} - - - - junit - junit - 3.8.1 - - - - commons-lang - commons-lang - 2.2 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.6.3/release.bat b/basics/tags/0.6.3/release.bat deleted file mode 100644 index 1f4f50f8..00000000 --- a/basics/tags/0.6.3/release.bat +++ /dev/null @@ -1,5 +0,0 @@ -rem update versions -mvn clean install -Psamples -Ptests -Pdist -mvn scm:tag -Dtag=%1 -mvn -Psamples -Ptests -Pdist -DperformRelease -Psonatype-oss-release clean deploy -rem update versions \ No newline at end of file diff --git a/basics/tags/0.6.3/runtime/.classpath b/basics/tags/0.6.3/runtime/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.3/runtime/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.3/runtime/.project b/basics/tags/0.6.3/runtime/.project deleted file mode 100644 index e2a9acd9..00000000 --- a/basics/tags/0.6.3/runtime/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/runtime/pom.xml b/basics/tags/0.6.3/runtime/pom.xml deleted file mode 100644 index ca5f2fa0..00000000 --- a/basics/tags/0.6.3/runtime/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - - - bundle-manifest - process-classes - - manifest - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index 6a33cd15..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,295 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return ((Equals) lhs).equals(leftLocator, rightLocator, rhs, this); - } else { - return lhs.equals(rhs); - } - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), item(rightLocator, i, - right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index 2da953fe..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,240 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCode * iConstant - + ((HashCode) value).hashCode(locator, this); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index 2f2bb16a..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 1fcb3077..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 8407ab35..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - public String getPathAsString() { - final String stepAsString = getStepAsString(); - final ObjectLocator parentLocator = getParentLocator(); - return parentLocator == null ? stepAsString : parentLocator - .getPathAsString() + stepAsString; - } - - protected abstract String getStepAsString(); - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - - // public Object[] getMessageParameters() { - // return new Object[] { getObject() }; - // } - // - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() + ".messages")); - } - - // public int hashCode() { - // int hashCode = getObject().hashCode(); - // return hashCode; - // } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index ce0d32ff..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "[" + getIndex() + "]"; - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index 0484223a..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "." + getPropertyName(); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index ecd6fc3e..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return ""; - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 37aa8555..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * @return Path to this locator in string form; - */ - public String getPathAsString(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index b29bad1e..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MClassInfo getBaseTypeInfo(); - - public String getName(); - - public String getLocalName(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index eb91799e..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 8f896718..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 26947454..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 6afbd3b0..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index bc10b7c2..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 7bf53eb7..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 318bb794..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor { - - public V visitList(MList info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - - public V visitClassInfo(MClassInfo info); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 85df90f2..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index 637c8a68..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MClassInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MClassInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MClassInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index 45644f54..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - QName elementName, MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index d25eb09e..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 7a059903..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo { - - private final MEnumLeafInfoOrigin origin; - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index 8ab0bb5d..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,481 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - if (!list) { - return ti; - } else { - return new CMList(createListType(ti.getTargetType()), ti); - } - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - private MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()), - info.isElement() ? info.getElementName() : null); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract MPackageInfo getPackage(EI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - getTypeInfo(baseType), info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 9c4098be..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index 3a12e0d8..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,209 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 37af6535..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index a2a7eda3..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo { - - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index d2e65547..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index df1c16d2..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.6.3/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.6.3/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.6.3/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.6.3/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.6.3/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.6.3/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.6.3/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.6.3/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.6.3/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.6.3/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.6.3/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.6.3/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/annotate/pom.xml b/basics/tags/0.6.3/samples/annotate/pom.xml deleted file mode 100644 index 688b4361..00000000 --- a/basics/tags/0.6.3/samples/annotate/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate - pom - JAXB2 Basics - Sample [annotate] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.3 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - org.hibernate - hibernate-search - 3.0.0.GA - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/annotate/project-build.xml b/basics/tags/0.6.3/samples/annotate/project-build.xml deleted file mode 100644 index 7998d52b..00000000 --- a/basics/tags/0.6.3/samples/annotate/project-build.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/annotate/project-pom.xml b/basics/tags/0.6.3/samples/annotate/project-pom.xml deleted file mode 100644 index 1fe0f540..00000000 --- a/basics/tags/0.6.3/samples/annotate/project-pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate-maven - ${project.version} - jar - JAXB2 Basics - Sample [annotate-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - provided - - - org.hibernate - hibernate-search - 3.0.0.GA - provided - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - - - org.hibernate - hibernate-search - 3.0.0.GA - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.3/samples/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index 0a07b0ff..00000000 --- a/basics/tags/0.6.3/samples/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.3/samples/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.3/samples/annotate/src/main/resources/schema.xsd deleted file mode 100644 index d991150f..00000000 --- a/basics/tags/0.6.3/samples/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/basic/pom.xml b/basics/tags/0.6.3/samples/basic/pom.xml deleted file mode 100644 index 4624c503..00000000 --- a/basics/tags/0.6.3/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.3 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/basic/project-build.xml b/basics/tags/0.6.3/samples/basic/project-build.xml deleted file mode 100644 index 6fddf3b1..00000000 --- a/basics/tags/0.6.3/samples/basic/project-build.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/basic/project-pom.xml b/basics/tags/0.6.3/samples/basic/project-pom.xml deleted file mode 100644 index a77bfdcd..00000000 --- a/basics/tags/0.6.3/samples/basic/project-pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/basic/src/main/assembly/src.xml b/basics/tags/0.6.3/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.6.3/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.6.3/samples/basic/src/main/java/.placeholder b/basics/tags/0.6.3/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.3/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.6.3/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.3/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.3/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.3/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.6.3/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.3/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/basic/src/test/samples/1.xml b/basics/tags/0.6.3/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.3/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.3/samples/modular-ant/pom.xml b/basics/tags/0.6.3/samples/modular-ant/pom.xml deleted file mode 100644 index 9bc5cc34..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.3 - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/modular-ant/project-build.xml b/basics/tags/0.6.3/samples/modular-ant/project-build.xml deleted file mode 100644 index c598b256..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.6.3/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.6.3/samples/modular-ant/src/main/java/.placeholder b/basics/tags/0.6.3/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.3/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.6.3/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.3/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.6.3/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.6.3/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.3/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.3/samples/po/pom.xml b/basics/tags/0.6.3/samples/po/pom.xml deleted file mode 100644 index 7ef9a6ad..00000000 --- a/basics/tags/0.6.3/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.3 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/po/project-build.xml b/basics/tags/0.6.3/samples/po/project-build.xml deleted file mode 100644 index 401deb52..00000000 --- a/basics/tags/0.6.3/samples/po/project-build.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/po/project-pom.xml b/basics/tags/0.6.3/samples/po/project-pom.xml deleted file mode 100644 index edf3ced9..00000000 --- a/basics/tags/0.6.3/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/po/src/main/java/.placeholder b/basics/tags/0.6.3/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.3/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.6.3/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.6.3/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.3/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.6.3/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.6.3/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.6.3/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.3/samples/po/src/test/resources/log4j.properties b/basics/tags/0.6.3/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.3/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/po/src/test/samples/po.xml b/basics/tags/0.6.3/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.6.3/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/pom.xml b/basics/tags/0.6.3/samples/pom.xml deleted file mode 100644 index 1c58e6b7..00000000 --- a/basics/tags/0.6.3/samples/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - po - basic - modular-ant - annotate - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/samples - - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/samples/src/main/assembly/ant-src.xml b/basics/tags/0.6.3/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.6.3/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.6.3/samples/src/main/assembly/maven-src.xml b/basics/tags/0.6.3/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.6.3/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.6.3/testing/.classpath b/basics/tags/0.6.3/testing/.classpath deleted file mode 100644 index e27f6e53..00000000 --- a/basics/tags/0.6.3/testing/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.3/testing/.project b/basics/tags/0.6.3/testing/.project deleted file mode 100644 index 22b73ea9..00000000 --- a/basics/tags/0.6.3/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/testing/pom.xml b/basics/tags/0.6.3/testing/pom.xml deleted file mode 100644 index 04ddf9cb..00000000 --- a/basics/tags/0.6.3/testing/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.3/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.6.3/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.6.3/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.6.3/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.6.3/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.6.3/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.6.3/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.6.3/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.6.3/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.6.3/testing/src/test/samples/1.xml b/basics/tags/0.6.3/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/tags/0.6.3/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.6.3/testing/src/test/samples/2.xml b/basics/tags/0.6.3/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/tags/0.6.3/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/annotate/.classpath b/basics/tags/0.6.3/tests/annotate/.classpath deleted file mode 100644 index c42a02b2..00000000 --- a/basics/tags/0.6.3/tests/annotate/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.3/tests/annotate/.project b/basics/tags/0.6.3/tests/annotate/.project deleted file mode 100644 index 282d843f..00000000 --- a/basics/tags/0.6.3/tests/annotate/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/tests/annotate/pom.xml b/basics/tags/0.6.3/tests/annotate/pom.xml deleted file mode 100644 index b8a8dc31..00000000 --- a/basics/tags/0.6.3/tests/annotate/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.3 - ../pom.xml - - jaxb2-basics-test-annotate - jar - JAXB2 Basics - Test [annotate] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - -Xannotate-defaultFieldTarget=setter - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.3/tests/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.3/tests/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index 9bdaaf89..00000000 --- a/basics/tags/0.6.3/tests/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.3/tests/annotate/src/main/resources/schema.xsd deleted file mode 100644 index 45b8239e..00000000 --- a/basics/tags/0.6.3/tests/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java b/basics/tags/0.6.3/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java deleted file mode 100644 index c59125b0..00000000 --- a/basics/tags/0.6.3/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.annotate; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunAnnotatePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } - -} diff --git a/basics/tags/0.6.3/tests/annox/.classpath b/basics/tags/0.6.3/tests/annox/.classpath deleted file mode 100644 index a225f00d..00000000 --- a/basics/tags/0.6.3/tests/annox/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/basics/tags/0.6.3/tests/annox/.project b/basics/tags/0.6.3/tests/annox/.project deleted file mode 100644 index 8686d22a..00000000 --- a/basics/tags/0.6.3/tests/annox/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/tests/annox/annotations/.classpath b/basics/tags/0.6.3/tests/annox/annotations/.classpath deleted file mode 100644 index 2daddec3..00000000 --- a/basics/tags/0.6.3/tests/annox/annotations/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.3/tests/annox/annotations/.project b/basics/tags/0.6.3/tests/annox/annotations/.project deleted file mode 100644 index 60d460cf..00000000 --- a/basics/tags/0.6.3/tests/annox/annotations/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox-annotations - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/tests/annox/annotations/pom.xml b/basics/tags/0.6.3/tests/annox/annotations/pom.xml deleted file mode 100644 index 8fe73521..00000000 --- a/basics/tags/0.6.3/tests/annox/annotations/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.3 - ../pom.xml - - jaxb2-basics-test-annox-annotations - jar - JAXB2 Basics - Test [annox-annotations] - diff --git a/basics/tags/0.6.3/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java b/basics/tags/0.6.3/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java deleted file mode 100644 index 8c21043b..00000000 --- a/basics/tags/0.6.3/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface Alpha { - long longField() default 1; - - int intField() default 2; - - short shortField() default 3; - - char charField() default 'f'; - - byte byteField() default 5; - - double doubleField() default 6.0; - - float floatField() default 7.0f; - - boolean booleanField() default true; - - Digits enumField() default Digits.EIGHT; - - String stringField() default "nine"; - - @SuppressWarnings("unchecked") - Class classField() default String.class; - - // B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java b/basics/tags/0.6.3/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java deleted file mode 100644 index a8b4e3e7..00000000 --- a/basics/tags/0.6.3/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -public enum Digits { - - ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE; - -} \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/annox/pom.xml b/basics/tags/0.6.3/tests/annox/pom.xml deleted file mode 100644 index 2efa9f32..00000000 --- a/basics/tags/0.6.3/tests/annox/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.3 - ../pom.xml - - jaxb2-basics-test-annox - pom - JAXB2 Basics - Test [annox] - - annotations - schema - - - diff --git a/basics/tags/0.6.3/tests/annox/schema/pom.xml b/basics/tags/0.6.3/tests/annox/schema/pom.xml deleted file mode 100644 index 3f6a68ae..00000000 --- a/basics/tags/0.6.3/tests/annox/schema/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.3 - ../pom.xml - - jaxb2-basics-test-annox-schema - jar - JAXB2 Basics - Test [annox-schema] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/annox/schema/src/main/resources/binding.xjb b/basics/tags/0.6.3/tests/annox/schema/src/main/resources/binding.xjb deleted file mode 100644 index 71117799..00000000 --- a/basics/tags/0.6.3/tests/annox/schema/src/main/resources/binding.xjb +++ /dev/null @@ -1,20 +0,0 @@ - - - jaxb:extensionBindingPrefixes="annox" - - - - - - 0 - 3 - - - - - diff --git a/basics/tags/0.6.3/tests/annox/schema/src/main/resources/schema.xsd b/basics/tags/0.6.3/tests/annox/schema/src/main/resources/schema.xsd deleted file mode 100644 index 7408ec40..00000000 --- a/basics/tags/0.6.3/tests/annox/schema/src/main/resources/schema.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - 0 - 3 - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/build-1.5.bat b/basics/tags/0.6.3/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.3/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/build-1.6.bat b/basics/tags/0.6.3/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.3/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/episodes/a/pom.xml b/basics/tags/0.6.3/tests/episodes/a/pom.xml deleted file mode 100644 index 8aec5441..00000000 --- a/basics/tags/0.6.3/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.3 - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.6.3/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.3/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.6.3/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.6.3/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.3/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.6.3/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.6.3/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/episodes/b/pom.xml b/basics/tags/0.6.3/tests/episodes/b/pom.xml deleted file mode 100644 index 10e8cdef..00000000 --- a/basics/tags/0.6.3/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.3 - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.6.3/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.3/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.6.3/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.6.3/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.6.3/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.6.3/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.3/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.6.3/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.6.3/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/episodes/pom.xml b/basics/tags/0.6.3/tests/episodes/pom.xml deleted file mode 100644 index 83b7a08d..00000000 --- a/basics/tags/0.6.3/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.3 - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/ignoring/pom.xml b/basics/tags/0.6.3/tests/ignoring/pom.xml deleted file mode 100644 index be0cefbb..00000000 --- a/basics/tags/0.6.3/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.3 - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.3/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.6.3/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.6.3/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/issues/.classpath b/basics/tags/0.6.3/tests/issues/.classpath deleted file mode 100644 index e2296a47..00000000 --- a/basics/tags/0.6.3/tests/issues/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.3/tests/issues/.project b/basics/tags/0.6.3/tests/issues/.project deleted file mode 100644 index d98a2c30..00000000 --- a/basics/tags/0.6.3/tests/issues/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/tests/issues/pom.xml b/basics/tags/0.6.3/tests/issues/pom.xml deleted file mode 100644 index 20b9023f..00000000 --- a/basics/tags/0.6.3/tests/issues/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.3 - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -Xequals-equalsStrategyClass=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB42EqualsStrategy - -XhashCode - -Xcopyable - -Xmergeable - -Xmergeable-mergeStrategyClass=org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy - -Xinheritance - -Xsetters - -Xsetters-mode=direct - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - -Xannotate - -Xsimplify - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java deleted file mode 100644 index 77921c47..00000000 --- a/basics/tags/0.6.3/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { - - @Override - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { - // Quasi custom equals - return super.equals(leftLocator, rightLocator, lhs, rhs); - } else { - return super.equals(leftLocator, rightLocator, lhs, rhs); - } - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/main/resources/binding.xjb b/basics/tags/0.6.3/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 1672089b..00000000 --- a/basics/tags/0.6.3/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,24 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - - - - - - diff --git a/basics/tags/0.6.3/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.6.3/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 3141903b..00000000 --- a/basics/tags/0.6.3/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java deleted file mode 100644 index 746bc3b7..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB20Test extends TestCase { - - public void testException() throws Exception { - - final List strings = Arrays.asList("a", "b", "c"); - final IssueJIIB20 one = new IssueJIIB20(); - one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); - - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java deleted file mode 100644 index 01ba2358..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB44Test extends TestCase { - - private JAXBContext context; - - @Override - protected void setUp() throws Exception { - context = JAXBContext.newInstance(getClass().getPackage().getName()); - } - - public void testReferencesPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_0.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testReferencesPropertyAsReferencePropertyType() - throws Exception { - - IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_1.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testElementsPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_2.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getString().size()); - Assert.assertEquals(3, value.getInt().size()); - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 2ea29226..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); -// args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xsetters-mode=direct"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); - args.add("-Xannotate"); - args.add("-Xsimplify"); - return args; - } - -} diff --git a/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml deleted file mode 100644 index 0915dfad..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml deleted file mode 100644 index b811fb9b..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml deleted file mode 100644 index 0008e3ee..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - a - b - 0 - c - 1 - 2 - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.6.3/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.6.3/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/one/.classpath b/basics/tags/0.6.3/tests/one/.classpath deleted file mode 100644 index c42a02b2..00000000 --- a/basics/tags/0.6.3/tests/one/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.3/tests/one/.project b/basics/tags/0.6.3/tests/one/.project deleted file mode 100644 index fb3eacf0..00000000 --- a/basics/tags/0.6.3/tests/one/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/tests/one/pom.xml b/basics/tags/0.6.3/tests/one/pom.xml deleted file mode 100644 index 056f327b..00000000 --- a/basics/tags/0.6.3/tests/one/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.3 - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.3/tests/one/src/main/resources/binding.xjb b/basics/tags/0.6.3/tests/one/src/main/resources/binding.xjb deleted file mode 100644 index d332e4ca..00000000 --- a/basics/tags/0.6.3/tests/one/src/main/resources/binding.xjb +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.3/tests/one/src/main/resources/schema.xsd b/basics/tags/0.6.3/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index e527b565..00000000 --- a/basics/tags/0.6.3/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.6.3/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.3/tests/one/src/test/resources/log4j.properties b/basics/tags/0.6.3/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.3/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/one/src/test/samples/1.xml b/basics/tags/0.6.3/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.3/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.3/tests/one/src/test/samples/2.xml b/basics/tags/0.6.3/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.6.3/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.6.3/tests/pom.xml b/basics/tags/0.6.3/tests/pom.xml deleted file mode 100644 index 3eccce83..00000000 --- a/basics/tags/0.6.3/tests/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - annotate - annox - episodes - one - issues - zj - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/samples - - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - - generate - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/zj/pom.xml b/basics/tags/0.6.3/tests/zj/pom.xml deleted file mode 100644 index 9ff80d2d..00000000 --- a/basics/tags/0.6.3/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.3 - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.3/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.6.3/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.6.3/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.6.3/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.6.3/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.3/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.6.3/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.3/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.3/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.6.3/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.6.3/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.6.3/tools/.classpath b/basics/tags/0.6.3/tools/.classpath deleted file mode 100644 index 24166ba5..00000000 --- a/basics/tags/0.6.3/tools/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/basics/tags/0.6.3/tools/.project b/basics/tags/0.6.3/tools/.project deleted file mode 100644 index 89093281..00000000 --- a/basics/tags/0.6.3/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/basics/tags/0.6.3/tools/pom.xml b/basics/tags/0.6.3/tools/pom.xml deleted file mode 100644 index da3ce28f..00000000 --- a/basics/tags/0.6.3/tools/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.3 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - commons-lang - commons-lang - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index 4fea93c7..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!StringUtils.isEmpty(namespaceURI)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d4ca11b5..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 7a749a79..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,600 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations(Outline outline, - QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(CElementInfo elementInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index bb81f031..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index a7e6b211..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = parent.getParent().getClassOutline( - classInfo.getBaseTypeInfo()); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 16f45c22..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 9535bcaa..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 59cda4e0..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index 2e6d3fa8..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - generateClassOutline(modelOutline, modelInfo, - classInfo.getBaseTypeInfo()); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index ee45b6b0..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index e43958e1..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 41dcc73f..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - public XJCCMInfoFactory(Model model) { - super(model); - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - private final Map packages = new HashMap(); - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 946ab670..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index f855af96..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index 7d59132d..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 4414b8ae..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 0c5e02a0..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index 7f414d27..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 70f7489d..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index d98988d0..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index b6673c80..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index b7df6bbe..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 1d3a1f57..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 517cbb27..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index ef8a2639..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index 5d7c77a2..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c632055a..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 7cd5160b..00000000 --- a/basics/tags/0.6.3/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/tags/0.6.3/update-all-versions.bat b/basics/tags/0.6.3/update-all-versions.bat deleted file mode 100644 index f8e2a12d..00000000 --- a/basics/tags/0.6.3/update-all-versions.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -call update-versions %cd% %1 %2 \ No newline at end of file diff --git a/basics/tags/0.6.3/update-version.bat b/basics/tags/0.6.3/update-version.bat deleted file mode 100644 index 8a52b653..00000000 --- a/basics/tags/0.6.3/update-version.bat +++ /dev/null @@ -1,3 +0,0 @@ -sed "s/%2/%3/g" %1 > %1.tmp -del %1 -move %1.tmp %1 \ No newline at end of file diff --git a/basics/tags/0.6.3/update-versions.bat b/basics/tags/0.6.3/update-versions.bat deleted file mode 100644 index 1499b4f4..00000000 --- a/basics/tags/0.6.3/update-versions.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -for /R %1 %%x in (pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.classpath) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.tomcatplugin) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-build.xml) do if exist %%x call update-version %%x %2 %3 diff --git a/basics/tags/0.6.4/annotate/.classpath b/basics/tags/0.6.4/annotate/.classpath deleted file mode 100644 index 0bfb90cc..00000000 --- a/basics/tags/0.6.4/annotate/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.4/annotate/.project b/basics/tags/0.6.4/annotate/.project deleted file mode 100644 index 0afe5f38..00000000 --- a/basics/tags/0.6.4/annotate/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.4/annotate/pom.xml b/basics/tags/0.6.4/annotate/pom.xml deleted file mode 100644 index 4a7054bb..00000000 --- a/basics/tags/0.6.4/annotate/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - jar - JAXB2 Basics - Annotate Plugin - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - commons-lang - commons-lang - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - org.jvnet.annox - annox - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.4/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java b/basics/tags/0.6.4/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java deleted file mode 100644 index 9678b232..00000000 --- a/basics/tags/0.6.4/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java +++ /dev/null @@ -1,409 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.annox.Constants; -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.parser.XAnnotationParser; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorUtils; -import org.jvnet.jaxb2_commons.util.OutlineUtils; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AnnotatePlugin extends AbstractParameterizablePlugin { - - private static final QName ANNOTATE_PROPERTY_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateProperty"); - private static final QName ANNOTATE_CLASS_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateClass"); - private static final QName ANNOTATE_ELEMENT_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateElement"); - private static final QName ANNOTATE_ENUM_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateEnum"); - private static final QName ANNOTATE_ENUM_CONSTANT_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateEnumConstant"); - private static final QName ANNOTATE_QNAME = new QName( - Constants.NAMESPACE_URI, "annotate"); - - @Override - public String getOptionName() { - return "Xannotate"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private String defaultFieldTarget = "getter"; - - public String getDefaultFieldTarget() { - return defaultFieldTarget; - } - - public void setDefaultFieldTarget(String defaultFieldTarget) { - if ("getter".equals(defaultFieldTarget) - || "setter".equals(defaultFieldTarget) - || "setter-parameter".equals(defaultFieldTarget) - || "field".equals(defaultFieldTarget)) { - this.defaultFieldTarget = defaultFieldTarget; - } else { - throw new IllegalArgumentException("Invalid default field target."); - } - } - - private XAnnotationParser annotationParser = XAnnotationParser.GENERIC; - - public XAnnotationParser getAnnotationParser() { - return annotationParser; - } - - public void setAnnotationParser(XAnnotationParser annotationParser) { - this.annotationParser = annotationParser; - } - - private Annotator annotator = new Annotator(); - - public Annotator getAnnotator() { - return annotator; - } - - public void setAnnotator(Annotator annotator) { - this.annotator = annotator; - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) { - - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, options, errorHandler); - } - } - - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, options, errorHandler); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, options, errorHandler); - } - return true; - } - - protected void processElementOutline(ElementOutline elementOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - - annotateElementOutline(elementOutline.implClass.owner(), - elementOutline, customizations, errorHandler); - } - - protected void processEnumOutline(EnumOutline enumOutline, Options options, - ErrorHandler errorHandler) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumOutline); - annotateEnumOutline(enumOutline.clazz.owner(), enumOutline, - customizations, errorHandler); - - for (final EnumConstantOutline enumConstantOutline : enumOutline.constants) { - processEnumConstantOutline(enumOutline, enumConstantOutline, - options, errorHandler); - } - - } - - protected void processClassOutline(ClassOutline classOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - - annotateClassOutline(classOutline.ref.owner(), classOutline, - customizations, errorHandler); - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - processFieldOutline(classOutline, fieldOutline, options, - errorHandler); - } - - } - - private void processFieldOutline(ClassOutline classOutline, - FieldOutline fieldOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - annotate(fieldOutline.parent().ref.owner(), fieldOutline, - customizations, errorHandler); - } - - private void processEnumConstantOutline(EnumOutline enumOutline, - EnumConstantOutline enumConstantOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumConstantOutline); - - annotateEnumConstantOutline(enumOutline.parent().getCodeModel(), - enumConstantOutline, customizations, errorHandler); - } - - protected void annotateElementOutline(final JCodeModel codeModel, - final ElementOutline elementOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ELEMENT_QNAME.equals(name)) { - - final JAnnotatable annotatable = elementOutline.implClass; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotateEnumOutline(final JCodeModel codeModel, - final EnumOutline enumOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ENUM_QNAME.equals(name)) { - - final JAnnotatable annotatable = enumOutline.clazz; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotateEnumConstantOutline(final JCodeModel codeModel, - final EnumConstantOutline enumConstantOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ENUM_CONSTANT_QNAME.equals(name)) { - - final JAnnotatable annotatable = enumConstantOutline.constRef; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - - } - } - } - } - - protected void annotateClassOutline(final JCodeModel codeModel, - final ClassOutline classOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - - customization.markAsAcknowledged(); - if (ANNOTATE_CLASS_QNAME.equals(name) - || ANNOTATE_QNAME.equals(name)) { - - final JAnnotatable annotatable = classOutline.ref; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotate(final JCodeModel codeModel, - final FieldOutline fieldOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_PROPERTY_QNAME.equals(name)) { - - final JAnnotatable annotatable; - - final String draftTarget = element.getAttribute("target"); - - final String target; - - if (draftTarget == null || "".equals(draftTarget)) { - target = getDefaultFieldTarget(); - } else { - target = draftTarget; - } - - if ("class".equals(target)) { - annotatable = fieldOutline.parent().ref; - } else if ("getter".equals(target)) { - final JMethod _getter = FieldAccessorUtils - .getter(fieldOutline); - if (_getter == null) { - logger.error(MessageFormat - .format("Could not annotate the getter of the field outline [{0}], getter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - - } - annotatable = _getter; - } else if ("setter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - if (_setter == null) { - logger.error(MessageFormat - .format("Could not annotate the setter of the field outline [{0}], setter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - } - annotatable = _setter; - } else if ("setter-parameter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - - if (_setter == null) { - logger.error(MessageFormat - .format("Could not annotate the setter parameter of the field outline [{0}], setter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - annotatable = null; - } else { - final JVar[] params = _setter.listParams(); - if (params.length != 1) { - logger.error(MessageFormat - .format("Could not annotate the setter parameter of the field outline [{0}], setter method must have a single parameter(this setter has {1}).", - - OutlineUtils - .getFieldName(fieldOutline), - params.length)); - annotatable = null; - } else { - annotatable = FieldAccessorUtils.setter( - fieldOutline).listParams()[0]; - } - } - } else if ("field".equals(target)) { - // Ok - final JFieldVar _field = FieldAccessorUtils - .field(fieldOutline); - if (_field == null) { - logger.error(MessageFormat - .format("Could not annotate the field of the field outline [{0}] since it could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - } - annotatable = _field; - - } else { - logger.error("Invalid annotation target [" + target - + "]."); - annotatable = null; - } - - if (annotatable != null) { - - annotate(codeModel, errorHandler, customization, - element, annotatable); - } - } - } - } - } - - private void annotate(final JCodeModel codeModel, - ErrorHandler errorHandler, - final CPluginCustomization customization, final Element element, - final JAnnotatable annotatable) { - final NodeList elements = element.getChildNodes(); - for (int index = 0; index < elements.getLength(); index++) { - final Node node = elements.item(index); - if (node.getNodeType() == Node.ELEMENT_NODE) { - final Element child = (Element) node; - - try { - final XAnnotation annotation = getAnnotationParser().parse( - child); - getAnnotator().annotate(codeModel, annotatable, annotation); - } catch (Exception ex) { - try { - errorHandler.error(new SAXParseException( - "Error parsing annotation.", - customization.locator, ex)); - } catch (SAXException ignored) { - // Nothing to do - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(ANNOTATE_QNAME, ANNOTATE_CLASS_QNAME, - ANNOTATE_ELEMENT_QNAME, ANNOTATE_PROPERTY_QNAME); - } - -} diff --git a/basics/tags/0.6.4/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java b/basics/tags/0.6.4/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java deleted file mode 100644 index 2eacc503..00000000 --- a/basics/tags/0.6.4/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java +++ /dev/null @@ -1,314 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.lang.reflect.Field; -import java.util.Collection; -import java.util.List; - -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.model.XAnnotationField; -import org.jvnet.annox.model.XAnnotationField.XAnnotationArray; -import org.jvnet.annox.model.XAnnotationField.XBoolean; -import org.jvnet.annox.model.XAnnotationField.XBooleanArray; -import org.jvnet.annox.model.XAnnotationField.XByte; -import org.jvnet.annox.model.XAnnotationField.XByteArray; -import org.jvnet.annox.model.XAnnotationField.XChar; -import org.jvnet.annox.model.XAnnotationField.XCharArray; -import org.jvnet.annox.model.XAnnotationField.XClass; -import org.jvnet.annox.model.XAnnotationField.XClassArray; -import org.jvnet.annox.model.XAnnotationField.XDouble; -import org.jvnet.annox.model.XAnnotationField.XDoubleArray; -import org.jvnet.annox.model.XAnnotationField.XEnum; -import org.jvnet.annox.model.XAnnotationField.XEnumArray; -import org.jvnet.annox.model.XAnnotationField.XFloat; -import org.jvnet.annox.model.XAnnotationField.XFloatArray; -import org.jvnet.annox.model.XAnnotationField.XInt; -import org.jvnet.annox.model.XAnnotationField.XIntArray; -import org.jvnet.annox.model.XAnnotationField.XLong; -import org.jvnet.annox.model.XAnnotationField.XLongArray; -import org.jvnet.annox.model.XAnnotationField.XShort; -import org.jvnet.annox.model.XAnnotationField.XShortArray; -import org.jvnet.annox.model.XAnnotationField.XString; -import org.jvnet.annox.model.XAnnotationField.XStringArray; -import org.jvnet.annox.model.XAnnotationVisitor; -import org.jvnet.jaxb2_commons.util.CodeModelUtils; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationArrayMember; -import com.sun.codemodel.JAnnotationUse; -import com.sun.codemodel.JAnnotationValue; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFormatter; -import com.sun.codemodel.JType; - -public class Annotator { - - public static final Annotator INSTANCE = new Annotator(); - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - Collection xannotations) { - for (final XAnnotation xannotation : xannotations) { - if (xannotation != null) { - annotate(codeModel, annotatable, xannotation); - } - } - } - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - XAnnotation xannotation) { - final JClass annotationClass = codeModel.ref(xannotation - .getAnnotationClass()); - JAnnotationUse annotationUse = null; - for (JAnnotationUse annotation : annotatable.annotations()) { - if (annotationClass.equals(annotation.getAnnotationClass())) { - annotationUse = annotation; - } - } - if (annotationUse == null) { - annotationUse = annotatable.annotate(annotationClass); - } - final XAnnotationVisitor visitor = createAnnotationFieldVisitor( - codeModel, annotationUse); - xannotation.accept(visitor); - - } - - protected XAnnotationVisitor createAnnotationFieldVisitor( - JCodeModel codeModel, final JAnnotationUse annotationUse) { - final XAnnotationVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return visitor; - } - - public static class AnnotatingFieldVisitor implements - XAnnotationVisitor { - - protected final JCodeModel codeModel; - - protected final JAnnotationUse use; - - public AnnotatingFieldVisitor(final JCodeModel codeModel, - final JAnnotationUse use) { - this.codeModel = codeModel; - this.use = use; - } - - public JAnnotationUse visitAnnotation(XAnnotation annotation) { - for (final XAnnotationField field : annotation.getFieldsList()) { - field.accept(this); - } - return use; - } - - public JAnnotationUse visitBooleanField(XBoolean field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitByteField(XByte field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitCharField(XChar field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitClassField(XClass field) { - JType type = CodeModelUtils.ref(codeModel, field.getClassName()); - return use.param(field.getName(), type); - } - - public JAnnotationUse visitDoubleField(XDouble field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitEnumField(XEnum field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitFloatField(XFloat field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitIntField(XInt field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitLongField(XLong field) { - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitShortField(XShort field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitStringField(XString field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitBooleanArrayField(XBooleanArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Boolean value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitByteArrayField(XByteArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Byte value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitCharArrayField(XCharArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Character value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitClassArrayField(XClassArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final String className : field.getClassNames()) { - final JType type = CodeModelUtils.ref(codeModel, className); - array.param(type); - } - return use; - } - - public JAnnotationUse visitDoubleArrayField(XDoubleArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Double value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitEnumArrayField(XEnumArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Enum value : field.getValue()) { - - final JAnnotationValue annotationValue = new JAnnotationValue() { - public void generate(JFormatter f) { - f.t(codeModel.ref(value.getDeclaringClass())).p('.') - .p(value.name()); - } - }; - - addParam(array, annotationValue); - } - return use; - } - - @SuppressWarnings("unchecked") - public void addParam(final JAnnotationArrayMember array, - JAnnotationValue annotationValue) { - try { - final Field values = JAnnotationArrayMember.class - .getDeclaredField("values"); - values.setAccessible(true); - ((List) values.get(array)) - .add(annotationValue); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - public JAnnotationUse visitFloatArrayField(XFloatArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Float value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitIntArrayField(XIntArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Integer value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitShortArrayField(XShortArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Short value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitStringArrayField(XStringArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final String value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationArrayField(XAnnotationArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - final XAnnotation[] annotations = field.getValue(); - for (final XAnnotation annotation : annotations) { - - final JAnnotationUse annotationUse = array.annotate(annotation - .getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - - annotation.accept(visitor); - - } - return use; - } - - public JAnnotationUse visitLongArrayField(XLongArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Long value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationField( - org.jvnet.annox.model.XAnnotationField.XAnnotation field) { - final JAnnotationUse annotationUse = use.annotationParam( - field.getName(), field.getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return field.getValue().accept(visitor); - } - - } - -} diff --git a/basics/tags/0.6.4/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.4/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 7f3c247c..00000000 --- a/basics/tags/0.6.4/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin \ No newline at end of file diff --git a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java b/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java deleted file mode 100644 index 0d06742d..00000000 --- a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface A { - long longField(); - - int intField(); - - short shortField(); - - char charField(); - - byte byteField(); - - double doubleField(); - - float floatField(); - - boolean booleanField(); - - String stringField(); - - E enumField(); - - Class classField(); - - B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java b/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java deleted file mode 100644 index 9f27a8d4..00000000 --- a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface B { - - long[] longArrayField(); - - int[] intArrayField(); - - short[] shortArrayField(); - - char[] charArrayField(); - - byte[] byteArrayField(); - - double[] doubleArrayField(); - - float[] floatArrayField(); - - boolean[] booleanArrayField(); - - String[] stringArrayField(); - - E[] enumArrayField(); - - Class[] classArrayField(); - - B.C[] annotationArrayField(); - - @Retention(RetentionPolicy.RUNTIME) - public static @interface C { - } -} \ No newline at end of file diff --git a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java b/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java deleted file mode 100644 index 4eae4782..00000000 --- a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface D { - -} diff --git a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java b/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java deleted file mode 100644 index f8e7b4e5..00000000 --- a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -public enum E { - - ONE, TWO, THREE, FOUR; - -} \ No newline at end of file diff --git a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java b/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java deleted file mode 100644 index fd8d8c21..00000000 --- a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface F { - String value(); - -} diff --git a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java b/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java deleted file mode 100644 index 106f53db..00000000 --- a/basics/tags/0.6.4/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.project.MavenProject; -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunPluginTest extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setProject(new MavenProject()); - mojo.setForceRegenerate(true); - mojo.setExtension(true); - - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } -} diff --git a/basics/tags/0.6.4/annotate/src/test/resources/schema.xsd b/basics/tags/0.6.4/annotate/src/test/resources/schema.xsd deleted file mode 100644 index 79a863a0..00000000 --- a/basics/tags/0.6.4/annotate/src/test/resources/schema.xsd +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/ant/.classpath b/basics/tags/0.6.4/ant/.classpath deleted file mode 100644 index 51a852fc..00000000 --- a/basics/tags/0.6.4/ant/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/basics/tags/0.6.4/ant/pom.xml b/basics/tags/0.6.4/ant/pom.xml deleted file mode 100644 index c675f40b..00000000 --- a/basics/tags/0.6.4/ant/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.4/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.6.4/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.6.4/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.6.4/basic/.classpath b/basics/tags/0.6.4/basic/.classpath deleted file mode 100644 index 0bfb90cc..00000000 --- a/basics/tags/0.6.4/basic/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.4/basic/pom.xml b/basics/tags/0.6.4/basic/pom.xml deleted file mode 100644 index 151440c6..00000000 --- a/basics/tags/0.6.4/basic/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.6.4 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - com.google.code.javaparser - javaparser - 1.0.8 - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.felix - - - maven-bundle-plugin - - - [2.3.7,) - - - manifest - - - - - - - - - - org.jvnet.jaxb2.maven2 - - - maven-jaxb2-plugin - - - [0.8.1,) - - - generate - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 176f243b..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(EnumOutline enumOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 0d007353..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(EnumOutline enumOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index 78a9987f..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,337 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String copyStrategyClass = JAXBCopyStrategy.class.getName(); - - public void setCopyStrategyClass(final String copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public String getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, codeModel - .ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, codeModel - .ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl(JMod.FINAL, theClass.owner().ref( - Object.class), "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), JExpr - .invoke("createNewInstance"), target)); - } else { - body - ._if(JExpr._null().eq(target)) - ._then() - ._throw( - JExpr - ._new( - theClass - .owner() - .ref( - IllegalArgumentException.class)) - .arg( - "Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator).arg( - draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", JExpr - .cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr.invoke( - copyStrategy, "copy").arg( - theClass.owner().ref(LocatorUtils.class) - .staticInvoke("property").arg(locator) - .arg( - fieldOutline.getPropertyInfo() - .getName(false)).arg( - sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), copyFieldType - .isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java deleted file mode 100644 index 0b550431..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/enumvalue"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java deleted file mode 100644 index 177a950c..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.EnumValue; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EnumValuePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XenumValue"; - } - - @Override - public String getUsage() { - return "Forces generated @XmlEnums implement the org.jvnet.jaxb2_commons.lang.EnumValue interface."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final EnumOutline enumOutline : outline.getEnums()) { - if (!getIgnoring().isIgnored(enumOutline)) { - processEnumOutline(enumOutline); - } - } - return true; - } - - protected void processEnumOutline(EnumOutline enumOutline) { - CEnumLeafInfo enumLeafInfo = enumOutline.target; - JClass enumType = enumLeafInfo.base.toType(enumOutline.parent(), - Aspect.EXPOSED).boxify(); - - final JDefinedClass theClass = enumOutline.clazz; - - ClassUtils._implements(theClass, theClass.owner().ref(EnumValue.class) - .narrow(enumType)); - - final JMethod enumValue$enumValue = theClass.method(JMod.PUBLIC, - enumType, "enumValue"); - enumValue$enumValue.body()._return(JExpr._this().invoke("value")); - } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 5d35be2b..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); - - public void setEqualsStrategyClass(String equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public String getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - // - // @SuppressWarnings("unused") - // final JMethod equals$equals = generateEquals$equals(enumOutline, - // theClass); - // } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } - - // protected JMethod generateEquals$equals(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // final JCodeModel codeModel = theClass.owner(); - // final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - // "equals"); - // - // { - // final JBlock body = equals.body(); - // final JVar leftLocator = equals.param(ObjectLocator.class, - // "thisLocator"); - // final JVar rightLocator = equals.param(ObjectLocator.class, - // "thatLocator"); - // final JVar object = equals.param(Object.class, "object"); - // final JVar equalsStrategy = equals.param(EqualsStrategy.class, - // "strategy"); - // - // body._return(equalsStrategy - // .invoke("equals") - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(leftLocator) - // .arg("value").arg(JExpr._this().ref("value"))) - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(rightLocator) - // .arg("value").arg(object.ref("value"))) - // .arg(JExpr._this().ref("value")).arg(object.ref("value"))); - // - // } - // return equals; - // } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index 571b6fbe..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); - - public void setHashCodeStrategyClass(String hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public String getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - // - // // @SuppressWarnings("unused") - // // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode = generateHashCode$hashCode( - // enumOutline, theClass); - // // @SuppressWarnings("unused") - // // final JMethod object$hashCode = generateObject$hashCode(enumOutline, - // // theClass); - // } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - return generateObject$hashCode(theClass); - } - - // protected JMethod generateObject$hashCode(final EnumOutline enumOutline, - // final JDefinedClass theClass) { - // return generateObject$hashCode(theClass); - // } - - private JMethod generateObject$hashCode(final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, - theClass.owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass - .owner().ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl( - fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign( - currentHashCode, - hashCodeStrategy - .invoke("hashCode") - .arg(codeModel - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(theValue)) - .arg(currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } - - // protected JMethod generateHashCode$hashCode(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // JCodeModel codeModel = theClass.owner(); - // final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - // codeModel.INT, "hashCode"); - // final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - // "locator"); - // final JVar hashCodeStrategy = hashCode$hashCode.param( - // HashCodeStrategy.class, "strategy"); - // final JBlock body = hashCode$hashCode.body(); - // - // body._return(hashCodeStrategy - // .invoke("hashCode") - // .arg(codeModel.ref(LocatorUtils.class).staticInvoke("property") - // .arg(locator).arg("value") - // .arg(JExpr._this().ref("value"))).arg(JExpr.lit(1)) - // .arg(JExpr._this().ref("value"))); - // - // return hashCode$hashCode; - // } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index 07f0ca00..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline); - } - } - processPackageOutlines(outline); - return true; - } - - private void processClassOutline(ClassOutline classOutline) { - - generateExtends(classOutline); - generateImplements(classOutline); - - } - - private void processEnumOutline(EnumOutline enumOutline) { - - generateExtends(enumOutline); - generateImplements(enumOutline); - - } - - private void processElementOutline(ElementOutline elementOutline) { - - generateExtends(elementOutline); - generateImplements(elementOutline); - - } - - private void processPackageOutlines(Outline outline) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface); - } - } - } - } - } - } - } - } - - private void generateExtends(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(EnumOutline enumOutline) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(ElementOutline elementOutline) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - generateExtends(theClass, extendsClassCustomization); - } - - private void generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization) - throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - generateExtends(theClass, extendsClass); - } - } - - private void generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass) { - if (extendsClass.getClassName() != null) { - final String _class = extendsClass.getClassName(); - final JClass targetClass = parseClass(_class, theClass.owner()); - theClass._extends(targetClass); - } - } - - private void generateImplements(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(EnumOutline enumOutline) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(ElementOutline elementOutline) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - generateImplements(theClass, implementsInterfaceCustomizations); - } - - private void generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations) - throws AssertionError { - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - generateImplements(theClass, implementsInterface); - } - } - } - - private void generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface) { - - String _interface = implementsInterface.getInterfaceName(); - if (_interface != null) { - final JClass targetClass = parseClass(_interface, theClass.owner()); - theClass._implements(targetClass); - } - } - - private final JavaTypeParser javaTypeParser = new JavaTypeParser(); - - private JClass parseClass(String _class, JCodeModel codeModel) { - return javaTypeParser.parseClass(_class, codeModel); - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java deleted file mode 100644 index 72cb5d87..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.JavaParser; -import japa.parser.ParseException; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class JavaTypeParser { - - static { - JavaParser.setCacheParser(false); - } - - public JClass parseClass(String _class, JCodeModel codeModel) { - JType type = parseType(_class, codeModel); - if (type instanceof JClass) { - return (JClass) type; - } else { - throw new IllegalArgumentException("Type [" + _class - + "] is not a class."); - } - } - - private JType parseType(String type, JCodeModel codeModel) { - final String text = "public class Ignored extends " + type + " {}"; - try { - CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - final List _extended = classDeclaration - .getExtends(); - final ClassOrInterfaceType classOrInterfaceType = _extended.get(0); - - return classOrInterfaceType.accept( - TypeToJTypeConvertingVisitor.INSTANCE, codeModel); - } catch (ParseException pex) { - throw new IllegalArgumentException( - "Could not parse the type definition [" + type + "].", pex); - } catch (UnsupportedEncodingException uex) { - throw new UnsupportedOperationException(uex); - } - } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java deleted file mode 100644 index cb901028..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import java.util.ArrayList; -import java.util.List; - -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; -import japa.parser.ast.visitor.GenericVisitorAdapter; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class TypeToJTypeConvertingVisitor extends - GenericVisitorAdapter { - - public static TypeToJTypeConvertingVisitor INSTANCE = new TypeToJTypeConvertingVisitor(); - - @Override - public JType visit(VoidType type, JCodeModel codeModel) { - return codeModel.VOID; - } - - @Override - public JType visit(PrimitiveType type, JCodeModel codeModel) { - switch (type.getType()) { - case Boolean: - return codeModel.BOOLEAN; - case Char: - return codeModel.CHAR; - case Byte: - return codeModel.BYTE; - case Short: - return codeModel.SHORT; - case Int: - return codeModel.INT; - case Long: - return codeModel.LONG; - case Float: - return codeModel.FLOAT; - case Double: - return codeModel.DOUBLE; - default: - throw new AssertionError("Unknown primitive type [" - + type.getType() + "]"); - } - } - - @Override - public JType visit(ReferenceType type, JCodeModel codeModel) { - final JType referencedType = type.getType().accept(this, codeModel); - - JType referencedTypeArray = referencedType; - for (int index = 0; index < type.getArrayCount(); index++) { - referencedTypeArray = referencedTypeArray.array(); - } - return referencedTypeArray; - } - - @Override - public JType visit(WildcardType type, JCodeModel codeModel) { - - if (type.getExtends() != null) { - final ReferenceType _extends = type.getExtends(); - final JType boundType = _extends.accept(this, codeModel); - - if (!(boundType instanceof JClass)) { - throw new IllegalArgumentException("Bound type [" + _extends - + "]in the wildcard type must be class."); - } - - final JClass boundClass = (JClass) boundType; - return boundClass.wildcard(); - } else if (type.getSuper() != null) { - // TODO - throw new IllegalArgumentException( - "Wildcard types with super clause are not supported at the moment."); - } else { - throw new IllegalArgumentException( - "Wildcard type must have either extends or super clause."); - } - } - - @Override - public JType visit(ClassOrInterfaceType type, JCodeModel codeModel) { - final JClass jclass = codeModel.ref(getName(type)); - final List typeArgs = type.getTypeArgs(); - if (typeArgs == null || typeArgs.isEmpty()) { - return jclass; - } else { - final List jtypeArgs = new ArrayList( - typeArgs.size()); - for (Type typeArg : typeArgs) { - final JType jtype = typeArg.accept(this, codeModel); - if (!(jtype instanceof JClass)) { - throw new IllegalArgumentException("Type argument [" - + typeArg.toString() + "] is not a class."); - } else { - jtypeArgs.add((JClass) jtype); - } - } - return jclass.narrow(jtypeArgs); - } - } - - private String getName(ClassOrInterfaceType type) { - final String name = type.getName(); - final ClassOrInterfaceType scope = type.getScope(); - if (scope == null) { - return name; - } else { - return getName(scope) + "." + name; - } - } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index c83e1901..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); - - public void setMergeStrategyClass( - final String mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public String getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index d94d6a45..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - public static enum Mode { - - accessor { - - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(setter.body()); - accessor.fromRawValue(setter.body(), "draft", value); - } - }, - direct { - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - - final JFieldVar field = theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - - if (field != null) { - setter.body().assign(JExpr._this().ref(field), value); - } else { - // Fallback to the accessor - Mode.accessor.generateSetter(fieldOutline, theClass, - setter, value); - } - } - }; - public abstract void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value); - } - - private Mode mode = Mode.accessor; - - public String getMode() { - return mode.name(); - - } - - public void setMode(String mode) { - Validate.notNull(mode); - try { - this.mode = Mode.valueOf(mode); - } catch (IllegalArgumentException iaex) { - throw new IllegalArgumentException( - "Unsupported mode [" - + mode - + "]." - + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" - + " and [direct] (assigns the value to the field directly)."); - } - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - - mode.generateSetter(fieldOutline, theClass, - generatedSetter, value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java deleted file mode 100644 index 783cf37b..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - - public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-element-property"); - - public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-reference-property"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java deleted file mode 100644 index 97de9dd7..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeRef; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.ID; - -public class SimplifyPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xsimplify"; - } - - @Override - public String getUsage() { - return "This plugin allows simplifying \"complex\" properties" - + " (ex. aOrBOrC generated from repeatable choices)" - + " into several \"simple\" properties (ex. a, b, c).\n" - + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" - + " for plugin documentation."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public void postProcessModel(final Model model, ErrorHandler errorHandler) { - - for (final CClassInfo classInfo : model.beans().values()) { - postProcessClassInfo(model, classInfo); - } - } - - private void postProcessClassInfo(final Model model, - final CClassInfo classInfo) { - final List properties = new ArrayList( - classInfo.getProperties()); - for (CPropertyInfo property : properties) { - property.accept(new CPropertyVisitor() { - - public Void onElement(CElementPropertyInfo elementProperty) { - postProcessElementPropertyInfo(model, classInfo, - elementProperty); - return null; - } - - public Void onAttribute(CAttributePropertyInfo attributeProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onValue(CValuePropertyInfo valueProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onReference(CReferencePropertyInfo p) { - postProcessReferencePropertyInfo(model, classInfo, p); - return null; - } - - }); - } - } - - private void postProcessElementPropertyInfo(final Model model, - final CClassInfo classInfo, CElementPropertyInfo property) { - if (property.isCollection() && property.getTypes().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyElementPropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } - } - } - - private void postProcessReferencePropertyInfo(final Model model, - final CClassInfo classInfo, CReferencePropertyInfo property) { - if (property.isCollection() && property.getElements().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } else if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsReferencePropertyInfo(model, - classInfo, property); - } - } - } - - private void simplifyElementPropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CElementPropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CTypeRef typeRef : property.getTypes()) { - final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( - model, property, typeRef); - classInfo.getProperties().add(index++, elementPropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsReferencePropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( - model, property, element); - classInfo.getProperties().add(index++, referencePropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CElementPropertyInfo elementPropertyInfo; - if (element instanceof CElementInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CElementInfo) element); - } else if (element instanceof CClassInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CClassInfo) element); - - } else if (element instanceof CClassRef) { - // elementPropertyInfo = createElementPropertyInfo(model, - // element, - // (CClassRef) element); - elementPropertyInfo = null; - // TODO WARN - - } else { - // TODO WARN - elementPropertyInfo = null; - } - if (elementPropertyInfo != null) { - classInfo.getProperties().add(index++, elementPropertyInfo); - } - } - classInfo.getProperties().remove(property); - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CElementInfo elementInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(elementInfo.getContentType(), element - .getElementName(), elementInfo.getContentType() - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CClassInfo classInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(classInfo, element.getElementName(), classInfo - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - // private CElementPropertyInfo createElementPropertyInfo(final Model model, - // CElement element, final CClassRef cr) { - // final CElementPropertyInfo elementPropertyInfo; - // final String propertyName = createPropertyName(model, element); - // elementPropertyInfo = new CElementPropertyInfo(propertyName, - // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - // element.getSchemaComponent(), element.getCustomizations(), - // element.getLocator(), false); - // elementPropertyInfo.getTypes().add( - // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), - // false, null)); - // return elementPropertyInfo; - // } - - private CReferencePropertyInfo createReferencePropertyInfo( - final Model model, CReferencePropertyInfo property, CElement element) { - final String propertyName = createPropertyName(model, element); - final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( - propertyName, true, false, property.isMixed(), - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), property.isDummy(), property.isContent(), - property.isMixedExtendedCust()); - referencePropertyInfo.getElements().add(element); - return referencePropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElementPropertyInfo property, CTypeRef typeRef) { - final String propertyName = createPropertyName(model, typeRef); - boolean required = false; - final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( - propertyName, CollectionMode.REPEATED_ELEMENT, typeRef - .getTarget().idUse(), typeRef.getTarget() - .getExpectedMimeType(), property.getSchemaComponent(), - property.getCustomizations(), property.getLocator(), required); - elementPropertyInfo.getTypes().add(typeRef); - return elementPropertyInfo; - } - - private String createPropertyName(final Model model, CElement element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getElementName().getLocalPart()); - return propertyName; - } - - private String createPropertyName(final Model model, CTypeRef element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getTagName().getLocalPart()); - return propertyName; - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index dc8eac3c..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); - - public void setToStringStrategyClass( - String toStringStrategy) { - this.toStringStrategyClass = toStringStrategy; - } - - public String getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 6f95d0b1..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final String strategyClassName) { - - try { - final Class strategyClass = Class.forName(strategyClassName); - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } catch (ClassNotFoundException cnfex) { - final JClass strategyJClass = codeModel.ref(strategyClassName); - return JExpr._new(strategyJClass); - } - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index b44a1cb3..00000000 --- a/basics/tags/0.6.4/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - final boolean laxModel = CustomizationUtils.containsCustomization( - model, Customizations.LAX_ELEMENT_NAME); - final boolean skipModel = CustomizationUtils.containsCustomization( - model, Customizations.SKIP_ELEMENT_NAME); - final boolean strictModel = CustomizationUtils.containsCustomization( - model, Customizations.STRICT_ELEMENT_NAME); - for (CClassInfo classInfo : model.beans().values()) { - final boolean laxClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.STRICT_ELEMENT_NAME); - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - final boolean laxPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME); - - if (laxModel) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipModel) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictModel) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.4/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.4/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 99ef7147..00000000 --- a/basics/tags/0.6.4/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,13 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin -org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin -org.jvnet.jaxb2_commons.plugin.enumvalue.EnumValuePlugin \ No newline at end of file diff --git a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java b/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java deleted file mode 100644 index 30bdf587..00000000 --- a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; - -public class JavaParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final JavaTypeParser javaTypeParser = new JavaTypeParser(); - final JCodeModel codeModel = new JCodeModel(); - JClass comparator = javaTypeParser.parseClass("java.util.Comparator", - codeModel); - assertNotNull(comparator); - JClass integerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(integerComparator); - JClass wildcardIntegerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(wildcardIntegerComparator); - } -} diff --git a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java b/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java deleted file mode 100644 index a2562048..00000000 --- a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; - -import java.io.ByteArrayInputStream; -import java.util.List; - -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - assertEquals(1, typeDeclarations.size()); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - assertEquals("Dummy", classDeclaration.getName()); - final List implementedInterfaces = classDeclaration - .getImplements(); - assertEquals(1, implementedInterfaces.size()); - final ClassOrInterfaceType implementedInterface = implementedInterfaces - .get(0); - assertEquals("Comparator", implementedInterface.getName()); - final List typeArgs = implementedInterface.getTypeArgs(); - assertEquals(1, typeArgs.size()); - final Type typeArg = typeArgs.get(0); - assertTrue(typeArg instanceof ReferenceType); - final ReferenceType referenceTypeArg = (ReferenceType) typeArg; - final Type referencedType = referenceTypeArg.getType(); - assertTrue(referencedType instanceof ClassOrInterfaceType); - final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; - assertEquals("Integer", typeArgType.getName()); - - } -} diff --git a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.6.4/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.6.4/basic/src/test/resources/schema.xsd b/basics/tags/0.6.4/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.6.4/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/build-1.5.bat b/basics/tags/0.6.4/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.4/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.4/build-1.6.bat b/basics/tags/0.6.4/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.4/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.4/deploy.bat b/basics/tags/0.6.4/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/tags/0.6.4/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/tags/0.6.4/dist/pom.xml b/basics/tags/0.6.4/dist/pom.xml deleted file mode 100644 index 20435df7..00000000 --- a/basics/tags/0.6.4/dist/pom.xml +++ /dev/null @@ -1,164 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/dist - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - - diff --git a/basics/tags/0.6.4/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.6.4/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.6.4/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.4/dist/src/main/assembly/dist.xml b/basics/tags/0.6.4/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.6.4/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.4/install-1.5.bat b/basics/tags/0.6.4/install-1.5.bat deleted file mode 100644 index 24bfffb2..00000000 --- a/basics/tags/0.6.4/install-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.4/install-1.6.bat b/basics/tags/0.6.4/install-1.6.bat deleted file mode 100644 index cbb92aa4..00000000 --- a/basics/tags/0.6.4/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.4/install.bat b/basics/tags/0.6.4/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/tags/0.6.4/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/tags/0.6.4/jaxb/release.bat b/basics/tags/0.6.4/jaxb/release.bat deleted file mode 100644 index e6784200..00000000 --- a/basics/tags/0.6.4/jaxb/release.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn clean deploy -DperformRelease=true -Psonatype-oss-release \ No newline at end of file diff --git a/basics/tags/0.6.4/pom.xml b/basics/tags/0.6.4/pom.xml deleted file mode 100644 index ec16fe9a..00000000 --- a/basics/tags/0.6.4/pom.xml +++ /dev/null @@ -1,357 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.6.4 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - org.highsource.static.jaxb2-basics - ${sftp.static.highsource.org}/jaxb2-basics - - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/trunk - - - ant - runtime - tools - testing - basic - annotate - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - dist - - - dist - - - - dist - - - - - 2.2.5-2 - 0.8.2 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - org.jvnet.annox - annox - 0.5.0 - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb.version} - - - - junit - junit - 3.8.1 - - - - commons-lang - commons-lang - 2.2 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.6.4/release.bat b/basics/tags/0.6.4/release.bat deleted file mode 100644 index 51f33868..00000000 --- a/basics/tags/0.6.4/release.bat +++ /dev/null @@ -1,5 +0,0 @@ -rem update versions -mvn clean install -DperformRelease -Psamples -Ptests -Pdist -mvn scm:tag -Dtag=%1 -mvn -Psamples -Ptests -Pdist -DperformRelease -Psonatype-oss-release clean deploy -rem update versions \ No newline at end of file diff --git a/basics/tags/0.6.4/runtime/.classpath b/basics/tags/0.6.4/runtime/.classpath deleted file mode 100644 index 0bfb90cc..00000000 --- a/basics/tags/0.6.4/runtime/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.4/runtime/.project b/basics/tags/0.6.4/runtime/.project deleted file mode 100644 index 5bfa86f3..00000000 --- a/basics/tags/0.6.4/runtime/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.4/runtime/pom.xml b/basics/tags/0.6.4/runtime/pom.xml deleted file mode 100644 index b780cad8..00000000 --- a/basics/tags/0.6.4/runtime/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - - - bundle-manifest - process-classes - - manifest - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index d66a74b7..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,371 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else if (lhs instanceof Equals[]) { - return equalsInternal(leftLocator, rightLocator, (Equals[]) lhs, - (Equals[]) rhs); - } else if (lhs instanceof Enum[]) { - return equalsInternal(leftLocator, rightLocator, (Enum[]) lhs, - (Enum[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else if (lhs instanceof Enum) { - return equalsInternal(leftLocator, rightLocator, (Enum) lhs, (Enum) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum lhs, Enum rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals lhs, Equals rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - return lhs.equals(leftLocator, rightLocator, rhs, this); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals[] left, Equals[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum[] left, Enum[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index e54659cd..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else if (object instanceof HashCode[]) { - return hashCodeInternal(locator, hashCode, (HashCode[]) object); - } else if (object instanceof Enum[]) { - return hashCodeInternal(locator, hashCode, (Enum[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else if (value instanceof Enum) { - return hashCodeInternal(locator, hashCode, (Enum) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode object) { - if (object == null) { - return hashCode * iConstant; - } else { - return hashCode * iConstant + object.hashCode(locator, this); - } - } - - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java deleted file mode 100644 index 9e843b88..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public interface EnumValue { - - public T enumValue(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index a6c06704..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 88b3cce7..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - // Treat empty lists as nulls - if (list.isEmpty()) { - return super.hashCode(locator, hashCode, (Object) null); - } else { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 8407ab35..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - public String getPathAsString() { - final String stepAsString = getStepAsString(); - final ObjectLocator parentLocator = getParentLocator(); - return parentLocator == null ? stepAsString : parentLocator - .getPathAsString() + stepAsString; - } - - protected abstract String getStepAsString(); - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - - // public Object[] getMessageParameters() { - // return new Object[] { getObject() }; - // } - // - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() + ".messages")); - } - - // public int hashCode() { - // int hashCode = getObject().hashCode(); - // return hashCode; - // } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index ce0d32ff..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "[" + getIndex() + "]"; - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index 0484223a..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "." + getPropertyName(); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index ecd6fc3e..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return ""; - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 37aa8555..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * @return Path to this locator in string form; - */ - public String getPathAsString(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index b70b0faf..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MClassInfo getBaseTypeInfo(); - - public String getName(); - - public String getLocalName(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java deleted file mode 100644 index 1a673485..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomizable { - - public MCustomizations getCustomizations(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java deleted file mode 100644 index 3e32cc52..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomization { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java deleted file mode 100644 index b20537dc..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MCustomizations { - - public List getCustomizations(); - - public void addCustomization(MCustomization customization); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index eb91799e..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 9e0b5b8c..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MCustomizable, - MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 26947454..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 6afbd3b0..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index bc10b7c2..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 98a86bc7..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo extends MCustomizable { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 318bb794..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor { - - public V visitList(MList info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - - public V visitClassInfo(MClassInfo info); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 6dd77b37..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - private final MCustomizations customizations = new CMCustomizations(); - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index d4934fce..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MClassInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MClassInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MClassInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java deleted file mode 100644 index 6e09ab64..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.w3c.dom.Element; - -public class CMCustomization implements MCustomization { - - private final Element element; - - public CMCustomization(Element element) { - this.element = element; - } - - public Element getElement() { - return element; - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java deleted file mode 100644 index c7bfa857..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; - -public class CMCustomizations implements MCustomizations { - - private final List customizations = new LinkedList(); - private final List unmodifiableCustomizations = Collections - .unmodifiableList(this.customizations); - - public List getCustomizations() { - return unmodifiableCustomizations; - } - - public void addCustomization(MCustomization customization) { - Validate.notNull(customization); - this.customizations.add(customization); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index 45644f54..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - QName elementName, MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index d25eb09e..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 6e1b9e66..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo, - MCustomizable { - - private final MEnumLeafInfoOrigin origin; - private final CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index 8ab0bb5d..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,481 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - if (!list) { - return ti; - } else { - return new CMList(createListType(ti.getTargetType()), ti); - } - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - private MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()), - info.isElement() ? info.getElementName() : null); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract MPackageInfo getPackage(EI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - getTypeInfo(baseType), info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 1e50748c..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index e3ee1ebd..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final CMCustomizations customizations = new CMCustomizations(); - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 37af6535..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index 196a11bd..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo, - MCustomizable { - - private CMCustomizations customizations = new CMCustomizations(); - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index 5f9236b9..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - private final MCustomizations customizations = new CMCustomizations(); - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index df1c16d2..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java deleted file mode 100644 index 43c96d12..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -public class PackageInfoQNameAnalyzer { - - private final MModelInfo modelInfo; - - public PackageInfoQNameAnalyzer(MModelInfo modelInfo) { - Validate.notNull(modelInfo); - this.modelInfo = modelInfo; - } - - public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - counter.add(name.getNamespaceURI()); - } - - public void attribute(QName name) { - - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - } - - public void attribute(QName name) { - counter.add(name.getNamespaceURI()); - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - private void collectNamespaceURIs(MPackageInfo packageInfo, - final QNameCollector collector) { - for (MElementInfo elementInfo : modelInfo.getElementInfos()) { - if (elementInfo.getPackageInfo() == packageInfo) { - collector.element(elementInfo.getElementName()); - } - } - - final QNameCollectingPropertyInfoVisitor visitor = new QNameCollectingPropertyInfoVisitor( - collector); - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - if (classInfo.getPackageInfo() == packageInfo) { - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - propertyInfo.acceptPropertyInfoVisitor(visitor); - } - } - } - } - - private static class NamespaceURICounter { - private Map map = new HashMap(); - - public void add(String namespaceURI) { - final Integer count = map.get(namespaceURI); - if (count == null) { - map.put(namespaceURI, Integer.valueOf(1)); - } else { - map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); - } - } - - public String getMostUsedNamespaceURI() { - String namespaceURI = null; - int count = 0; - - for (Map.Entry e : map.entrySet()) { - final String currentNamespaceURI = e.getKey(); - final int currentCount = e.getValue(); - if (namespaceURI == null) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } else { - if (currentCount > count - || (currentCount == count && namespaceURI == null)) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } - } - } - - return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; - - } - - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java deleted file mode 100644 index 6729008e..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class QNameCollectingPropertyInfoVisitor implements - MPropertyInfoVisitor { - - private final QNameCollector collector; - - public QNameCollectingPropertyInfoVisitor(QNameCollector collector) { - Validate.notNull(collector); - this.collector = collector; - } - - public Void visitElementPropertyInfo(MElementPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementsPropertyInfo(MElementsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } - - public Void visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return null; - } - - public Void visitAttributePropertyInfo(MAttributePropertyInfo info) { - collector.attribute(info.getAttributeName()); - return null; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - return null; - } - - public Void visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java deleted file mode 100644 index 2bd50907..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -public interface QNameCollector { - - public void element(QName name); - - public void attribute(QName name); -} diff --git a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.6.4/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.6.4/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.6.4/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.6.4/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.6.4/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.6.4/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.6.4/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.6.4/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.6.4/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.6.4/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.6.4/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.6.4/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/annotate/pom.xml b/basics/tags/0.6.4/samples/annotate/pom.xml deleted file mode 100644 index 37d67a53..00000000 --- a/basics/tags/0.6.4/samples/annotate/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate - pom - JAXB2 Basics - Sample [annotate] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - org.hibernate - hibernate-search - 4.1.1.Final - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/annotate/project-build.xml b/basics/tags/0.6.4/samples/annotate/project-build.xml deleted file mode 100644 index ad3e61df..00000000 --- a/basics/tags/0.6.4/samples/annotate/project-build.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/annotate/project-pom.xml b/basics/tags/0.6.4/samples/annotate/project-pom.xml deleted file mode 100644 index 28bcf196..00000000 --- a/basics/tags/0.6.4/samples/annotate/project-pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate-maven - ${project.version} - jar - JAXB2 Basics - Sample [annotate-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - provided - - - org.hibernate - hibernate-search - 4.1.1.Final - provided - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - - - org.hibernate - hibernate-search - 4.1.1.Final - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.4/samples/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index 0a07b0ff..00000000 --- a/basics/tags/0.6.4/samples/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.4/samples/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.4/samples/annotate/src/main/resources/schema.xsd deleted file mode 100644 index d991150f..00000000 --- a/basics/tags/0.6.4/samples/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/basic/pom.xml b/basics/tags/0.6.4/samples/basic/pom.xml deleted file mode 100644 index edc6c7bb..00000000 --- a/basics/tags/0.6.4/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/basic/project-build.xml b/basics/tags/0.6.4/samples/basic/project-build.xml deleted file mode 100644 index d644ea8f..00000000 --- a/basics/tags/0.6.4/samples/basic/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/basic/src/main/assembly/src.xml b/basics/tags/0.6.4/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.6.4/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.6.4/samples/basic/src/main/java/.placeholder b/basics/tags/0.6.4/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.4/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.6.4/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.4/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.4/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.4/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.6.4/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.4/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/basic/src/test/samples/1.xml b/basics/tags/0.6.4/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.4/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.4/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.6.4/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.6.4/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.6.4/samples/modular-ant/src/main/java/.placeholder b/basics/tags/0.6.4/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.4/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.6.4/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.4/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.4/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.4/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.6.4/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.4/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.6.4/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.4/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.4/samples/po/pom.xml b/basics/tags/0.6.4/samples/po/pom.xml deleted file mode 100644 index 35042b25..00000000 --- a/basics/tags/0.6.4/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/po/project-build.xml b/basics/tags/0.6.4/samples/po/project-build.xml deleted file mode 100644 index a22717d7..00000000 --- a/basics/tags/0.6.4/samples/po/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/po/project-pom.xml b/basics/tags/0.6.4/samples/po/project-pom.xml deleted file mode 100644 index edf3ced9..00000000 --- a/basics/tags/0.6.4/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/po/src/main/java/.placeholder b/basics/tags/0.6.4/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.4/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.6.4/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.6.4/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.4/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.6.4/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.6.4/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.6.4/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.4/samples/po/src/test/resources/log4j.properties b/basics/tags/0.6.4/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.4/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/po/src/test/samples/po.xml b/basics/tags/0.6.4/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.6.4/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/pom.xml b/basics/tags/0.6.4/samples/pom.xml deleted file mode 100644 index 147c6018..00000000 --- a/basics/tags/0.6.4/samples/pom.xml +++ /dev/null @@ -1,137 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - po - basic - annotate - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/samples - - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/samples/src/main/assembly/ant-src.xml b/basics/tags/0.6.4/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.6.4/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.6.4/samples/src/main/assembly/maven-src.xml b/basics/tags/0.6.4/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.6.4/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.6.4/testing/.classpath b/basics/tags/0.6.4/testing/.classpath deleted file mode 100644 index a8aec977..00000000 --- a/basics/tags/0.6.4/testing/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.4/testing/pom.xml b/basics/tags/0.6.4/testing/pom.xml deleted file mode 100644 index 1b85a2ea..00000000 --- a/basics/tags/0.6.4/testing/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.4/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.6.4/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.6.4/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.6.4/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.6.4/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.6.4/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.6.4/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.6.4/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.6.4/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.6.4/testing/src/test/samples/1.xml b/basics/tags/0.6.4/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/tags/0.6.4/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.6.4/testing/src/test/samples/2.xml b/basics/tags/0.6.4/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/tags/0.6.4/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/annotate/.classpath b/basics/tags/0.6.4/tests/annotate/.classpath deleted file mode 100644 index 0f040a45..00000000 --- a/basics/tags/0.6.4/tests/annotate/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.4/tests/annotate/.project b/basics/tags/0.6.4/tests/annotate/.project deleted file mode 100644 index c98c1330..00000000 --- a/basics/tags/0.6.4/tests/annotate/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.4/tests/annotate/pom.xml b/basics/tags/0.6.4/tests/annotate/pom.xml deleted file mode 100644 index 0cfe3baf..00000000 --- a/basics/tags/0.6.4/tests/annotate/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.4 - ../pom.xml - - jaxb2-basics-test-annotate - jar - JAXB2 Basics - Test [annotate] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - -Xannotate-defaultFieldTarget=setter - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.4/tests/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.4/tests/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index 9bdaaf89..00000000 --- a/basics/tags/0.6.4/tests/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.4/tests/annotate/src/main/resources/schema.xsd deleted file mode 100644 index 45b8239e..00000000 --- a/basics/tags/0.6.4/tests/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java b/basics/tags/0.6.4/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java deleted file mode 100644 index c59125b0..00000000 --- a/basics/tags/0.6.4/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.annotate; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunAnnotatePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } - -} diff --git a/basics/tags/0.6.4/tests/annox/.classpath b/basics/tags/0.6.4/tests/annox/.classpath deleted file mode 100644 index 464509f4..00000000 --- a/basics/tags/0.6.4/tests/annox/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/basics/tags/0.6.4/tests/annox/.project b/basics/tags/0.6.4/tests/annox/.project deleted file mode 100644 index edb8ceb5..00000000 --- a/basics/tags/0.6.4/tests/annox/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.4/tests/annox/annotations/.classpath b/basics/tags/0.6.4/tests/annox/annotations/.classpath deleted file mode 100644 index 0bfb90cc..00000000 --- a/basics/tags/0.6.4/tests/annox/annotations/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.4/tests/annox/annotations/.project b/basics/tags/0.6.4/tests/annox/annotations/.project deleted file mode 100644 index 20705668..00000000 --- a/basics/tags/0.6.4/tests/annox/annotations/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox-annotations - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.4/tests/annox/annotations/pom.xml b/basics/tags/0.6.4/tests/annox/annotations/pom.xml deleted file mode 100644 index 61400ded..00000000 --- a/basics/tags/0.6.4/tests/annox/annotations/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.4 - ../pom.xml - - jaxb2-basics-test-annox-annotations - jar - JAXB2 Basics - Test [annox-annotations] - diff --git a/basics/tags/0.6.4/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java b/basics/tags/0.6.4/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java deleted file mode 100644 index 8c21043b..00000000 --- a/basics/tags/0.6.4/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface Alpha { - long longField() default 1; - - int intField() default 2; - - short shortField() default 3; - - char charField() default 'f'; - - byte byteField() default 5; - - double doubleField() default 6.0; - - float floatField() default 7.0f; - - boolean booleanField() default true; - - Digits enumField() default Digits.EIGHT; - - String stringField() default "nine"; - - @SuppressWarnings("unchecked") - Class classField() default String.class; - - // B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java b/basics/tags/0.6.4/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java deleted file mode 100644 index a8b4e3e7..00000000 --- a/basics/tags/0.6.4/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -public enum Digits { - - ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE; - -} \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/annox/pom.xml b/basics/tags/0.6.4/tests/annox/pom.xml deleted file mode 100644 index 2ca845ed..00000000 --- a/basics/tags/0.6.4/tests/annox/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.4 - ../pom.xml - - jaxb2-basics-test-annox - pom - JAXB2 Basics - Test [annox] - - annotations - schema - - - diff --git a/basics/tags/0.6.4/tests/annox/schema/pom.xml b/basics/tags/0.6.4/tests/annox/schema/pom.xml deleted file mode 100644 index 856aca66..00000000 --- a/basics/tags/0.6.4/tests/annox/schema/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.4 - ../pom.xml - - jaxb2-basics-test-annox-schema - jar - JAXB2 Basics - Test [annox-schema] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/annox/schema/src/main/resources/binding.xjb b/basics/tags/0.6.4/tests/annox/schema/src/main/resources/binding.xjb deleted file mode 100644 index 71117799..00000000 --- a/basics/tags/0.6.4/tests/annox/schema/src/main/resources/binding.xjb +++ /dev/null @@ -1,20 +0,0 @@ - - - jaxb:extensionBindingPrefixes="annox" - - - - - - 0 - 3 - - - - - diff --git a/basics/tags/0.6.4/tests/annox/schema/src/main/resources/schema.xsd b/basics/tags/0.6.4/tests/annox/schema/src/main/resources/schema.xsd deleted file mode 100644 index 7408ec40..00000000 --- a/basics/tags/0.6.4/tests/annox/schema/src/main/resources/schema.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - 0 - 3 - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/build-1.5.bat b/basics/tags/0.6.4/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.4/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/build-1.6.bat b/basics/tags/0.6.4/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.4/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/episodes/a/pom.xml b/basics/tags/0.6.4/tests/episodes/a/pom.xml deleted file mode 100644 index 82e7685f..00000000 --- a/basics/tags/0.6.4/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.4 - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.6.4/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.4/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.6.4/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.6.4/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.4/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.6.4/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.6.4/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/episodes/b/pom.xml b/basics/tags/0.6.4/tests/episodes/b/pom.xml deleted file mode 100644 index d7d8bfa5..00000000 --- a/basics/tags/0.6.4/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.4 - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.6.4/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.4/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.6.4/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.6.4/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.6.4/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.6.4/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.4/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.6.4/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.6.4/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/episodes/pom.xml b/basics/tags/0.6.4/tests/episodes/pom.xml deleted file mode 100644 index faba9c8a..00000000 --- a/basics/tags/0.6.4/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.4 - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/ignoring/pom.xml b/basics/tags/0.6.4/tests/ignoring/pom.xml deleted file mode 100644 index df32566c..00000000 --- a/basics/tags/0.6.4/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.4 - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.4/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.6.4/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.6.4/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/issues/.classpath b/basics/tags/0.6.4/tests/issues/.classpath deleted file mode 100644 index fd1a8b60..00000000 --- a/basics/tags/0.6.4/tests/issues/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.4/tests/issues/.project b/basics/tags/0.6.4/tests/issues/.project deleted file mode 100644 index 444d922b..00000000 --- a/basics/tags/0.6.4/tests/issues/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.4/tests/issues/pom.xml b/basics/tags/0.6.4/tests/issues/pom.xml deleted file mode 100644 index 0bcdb1ed..00000000 --- a/basics/tags/0.6.4/tests/issues/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.4 - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -Xequals-equalsStrategyClass=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB42EqualsStrategy - -XhashCode - -Xcopyable - -Xmergeable - -Xmergeable-mergeStrategyClass=org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy - -Xinheritance - -Xsetters - -Xsetters-mode=direct - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - -Xannotate - -Xsimplify - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java deleted file mode 100644 index 77921c47..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { - - @Override - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { - // Quasi custom equals - return super.equals(leftLocator, rightLocator, lhs, rhs); - } else { - return super.equals(leftLocator, rightLocator, lhs, rhs); - } - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java b/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java deleted file mode 100644 index ff1fb59f..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB48Interface { - - public T getValue(); - -} diff --git a/basics/tags/0.6.4/tests/issues/src/main/resources/binding.xjb b/basics/tags/0.6.4/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 1672089b..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,24 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - - - - - - diff --git a/basics/tags/0.6.4/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.6.4/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 36371356..00000000 --- a/basics/tags/0.6.4/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,307 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB48Interface<java.lang.String> - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java deleted file mode 100644 index 746bc3b7..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB20Test extends TestCase { - - public void testException() throws Exception { - - final List strings = Arrays.asList("a", "b", "c"); - final IssueJIIB20 one = new IssueJIIB20(); - one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); - - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java deleted file mode 100644 index 01ba2358..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB44Test extends TestCase { - - private JAXBContext context; - - @Override - protected void setUp() throws Exception { - context = JAXBContext.newInstance(getClass().getPackage().getName()); - } - - public void testReferencesPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_0.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testReferencesPropertyAsReferencePropertyType() - throws Exception { - - IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_1.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testElementsPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_2.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getString().size()); - Assert.assertEquals(3, value.getInt().size()); - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 2ea29226..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); -// args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xsetters-mode=direct"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); - args.add("-Xannotate"); - args.add("-Xsimplify"); - return args; - } - -} diff --git a/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml deleted file mode 100644 index 0915dfad..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml deleted file mode 100644 index b811fb9b..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml deleted file mode 100644 index 0008e3ee..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - a - b - 0 - c - 1 - 2 - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.6.4/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.6.4/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/one/.classpath b/basics/tags/0.6.4/tests/one/.classpath deleted file mode 100644 index 0f040a45..00000000 --- a/basics/tags/0.6.4/tests/one/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.4/tests/one/.project b/basics/tags/0.6.4/tests/one/.project deleted file mode 100644 index ebe2a078..00000000 --- a/basics/tags/0.6.4/tests/one/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.4/tests/one/pom.xml b/basics/tags/0.6.4/tests/one/pom.xml deleted file mode 100644 index 41f5331b..00000000 --- a/basics/tags/0.6.4/tests/one/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.4 - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.4/tests/one/src/main/resources/binding.xjb b/basics/tags/0.6.4/tests/one/src/main/resources/binding.xjb deleted file mode 100644 index d332e4ca..00000000 --- a/basics/tags/0.6.4/tests/one/src/main/resources/binding.xjb +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.4/tests/one/src/main/resources/schema.xsd b/basics/tags/0.6.4/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index e527b565..00000000 --- a/basics/tags/0.6.4/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.6.4/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.4/tests/one/src/test/resources/log4j.properties b/basics/tags/0.6.4/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.4/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/one/src/test/samples/1.xml b/basics/tags/0.6.4/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.4/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.4/tests/one/src/test/samples/2.xml b/basics/tags/0.6.4/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.6.4/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.6.4/tests/pom.xml b/basics/tags/0.6.4/tests/pom.xml deleted file mode 100644 index a6ee00f4..00000000 --- a/basics/tags/0.6.4/tests/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - annotate - annox - episodes - one - issues - zj - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/tests - - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - - generate - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/wildcard/.classpath b/basics/tags/0.6.4/tests/wildcard/.classpath deleted file mode 100644 index fd1a8b60..00000000 --- a/basics/tags/0.6.4/tests/wildcard/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.4/tests/wildcard/.project b/basics/tags/0.6.4/tests/wildcard/.project deleted file mode 100644 index 4da28ca5..00000000 --- a/basics/tags/0.6.4/tests/wildcard/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-wildcard - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.4/tests/wildcard/pom.xml b/basics/tags/0.6.4/tests/wildcard/pom.xml deleted file mode 100644 index 789b3161..00000000 --- a/basics/tags/0.6.4/tests/wildcard/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.4 - ../pom.xml - - jaxb2-basics-test-wildcard - jar - JAXB2 Basics - Test [wildcard] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xwildcard - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.4/tests/wildcard/src/main/resources/binding.xjb b/basics/tags/0.6.4/tests/wildcard/src/main/resources/binding.xjb deleted file mode 100644 index 8f780f74..00000000 --- a/basics/tags/0.6.4/tests/wildcard/src/main/resources/binding.xjb +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/basics/tags/0.6.4/tests/wildcard/src/main/resources/schema.xsd b/basics/tags/0.6.4/tests/wildcard/src/main/resources/schema.xsd deleted file mode 100644 index 7d520ce9..00000000 --- a/basics/tags/0.6.4/tests/wildcard/src/main/resources/schema.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/zj/pom.xml b/basics/tags/0.6.4/tests/zj/pom.xml deleted file mode 100644 index c020b636..00000000 --- a/basics/tags/0.6.4/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.4 - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.4/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.6.4/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.6.4/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.6.4/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.6.4/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.4/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.6.4/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.4/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.4/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.6.4/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.6.4/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.6.4/tools/.classpath b/basics/tags/0.6.4/tools/.classpath deleted file mode 100644 index abfd54da..00000000 --- a/basics/tags/0.6.4/tools/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/basics/tags/0.6.4/tools/pom.xml b/basics/tags/0.6.4/tools/pom.xml deleted file mode 100644 index 5f3551e1..00000000 --- a/basics/tags/0.6.4/tools/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.4 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - commons-lang - commons-lang - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index 4fea93c7..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!StringUtils.isEmpty(namespaceURI)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d4ca11b5..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 176d5a2c..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,654 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(Outline outline, QName name) { - final CPluginCustomization customization = findCustomization(outline, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(Model model, QName name) { - final CPluginCustomization customization = findCustomization(model, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(EnumOutline enumOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - enumOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - Outline outline, QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CEnumLeafInfo enumLeafInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - enumLeafInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Outline outline, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(outline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Outline outline) { - return getCustomizations(outline.getModel()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index bb81f031..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index a7e6b211..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = parent.getParent().getClassOutline( - classInfo.getBaseTypeInfo()); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 16f45c22..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 9535bcaa..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 59cda4e0..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index 2e6d3fa8..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - generateClassOutline(modelOutline, modelInfo, - classInfo.getBaseTypeInfo()); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index ee45b6b0..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index e43958e1..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 41dcc73f..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - public XJCCMInfoFactory(Model model) { - super(model); - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - private final Map packages = new HashMap(); - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 946ab670..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index f855af96..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index 7d59132d..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 4414b8ae..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 0c5e02a0..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index 7f414d27..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 70f7489d..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index d98988d0..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index b6673c80..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index b7df6bbe..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 1d3a1f57..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 517cbb27..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index ef8a2639..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index 5d7c77a2..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c632055a..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 7cd5160b..00000000 --- a/basics/tags/0.6.4/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/tags/0.6.4/update-all-versions.bat b/basics/tags/0.6.4/update-all-versions.bat deleted file mode 100644 index f8e2a12d..00000000 --- a/basics/tags/0.6.4/update-all-versions.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -call update-versions %cd% %1 %2 \ No newline at end of file diff --git a/basics/tags/0.6.4/update-version.bat b/basics/tags/0.6.4/update-version.bat deleted file mode 100644 index 8a52b653..00000000 --- a/basics/tags/0.6.4/update-version.bat +++ /dev/null @@ -1,3 +0,0 @@ -sed "s/%2/%3/g" %1 > %1.tmp -del %1 -move %1.tmp %1 \ No newline at end of file diff --git a/basics/tags/0.6.4/update-versions.bat b/basics/tags/0.6.4/update-versions.bat deleted file mode 100644 index 1499b4f4..00000000 --- a/basics/tags/0.6.4/update-versions.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -for /R %1 %%x in (pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.classpath) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.tomcatplugin) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-build.xml) do if exist %%x call update-version %%x %2 %3 diff --git a/basics/tags/0.6.5/annotate/.classpath b/basics/tags/0.6.5/annotate/.classpath deleted file mode 100644 index ee6d2357..00000000 --- a/basics/tags/0.6.5/annotate/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.5/annotate/.project b/basics/tags/0.6.5/annotate/.project deleted file mode 100644 index 0afe5f38..00000000 --- a/basics/tags/0.6.5/annotate/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/annotate/pom.xml b/basics/tags/0.6.5/annotate/pom.xml deleted file mode 100644 index eda18d4c..00000000 --- a/basics/tags/0.6.5/annotate/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - jar - JAXB2 Basics - Annotate Plugin - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - commons-lang - commons-lang - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - org.jvnet.annox - annox - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.5/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java b/basics/tags/0.6.5/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java deleted file mode 100644 index 9678b232..00000000 --- a/basics/tags/0.6.5/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java +++ /dev/null @@ -1,409 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.annox.Constants; -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.parser.XAnnotationParser; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorUtils; -import org.jvnet.jaxb2_commons.util.OutlineUtils; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AnnotatePlugin extends AbstractParameterizablePlugin { - - private static final QName ANNOTATE_PROPERTY_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateProperty"); - private static final QName ANNOTATE_CLASS_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateClass"); - private static final QName ANNOTATE_ELEMENT_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateElement"); - private static final QName ANNOTATE_ENUM_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateEnum"); - private static final QName ANNOTATE_ENUM_CONSTANT_QNAME = new QName( - Constants.NAMESPACE_URI, "annotateEnumConstant"); - private static final QName ANNOTATE_QNAME = new QName( - Constants.NAMESPACE_URI, "annotate"); - - @Override - public String getOptionName() { - return "Xannotate"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private String defaultFieldTarget = "getter"; - - public String getDefaultFieldTarget() { - return defaultFieldTarget; - } - - public void setDefaultFieldTarget(String defaultFieldTarget) { - if ("getter".equals(defaultFieldTarget) - || "setter".equals(defaultFieldTarget) - || "setter-parameter".equals(defaultFieldTarget) - || "field".equals(defaultFieldTarget)) { - this.defaultFieldTarget = defaultFieldTarget; - } else { - throw new IllegalArgumentException("Invalid default field target."); - } - } - - private XAnnotationParser annotationParser = XAnnotationParser.GENERIC; - - public XAnnotationParser getAnnotationParser() { - return annotationParser; - } - - public void setAnnotationParser(XAnnotationParser annotationParser) { - this.annotationParser = annotationParser; - } - - private Annotator annotator = new Annotator(); - - public Annotator getAnnotator() { - return annotator; - } - - public void setAnnotator(Annotator annotator) { - this.annotator = annotator; - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) { - - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, options, errorHandler); - } - } - - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, options, errorHandler); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, options, errorHandler); - } - return true; - } - - protected void processElementOutline(ElementOutline elementOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - - annotateElementOutline(elementOutline.implClass.owner(), - elementOutline, customizations, errorHandler); - } - - protected void processEnumOutline(EnumOutline enumOutline, Options options, - ErrorHandler errorHandler) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumOutline); - annotateEnumOutline(enumOutline.clazz.owner(), enumOutline, - customizations, errorHandler); - - for (final EnumConstantOutline enumConstantOutline : enumOutline.constants) { - processEnumConstantOutline(enumOutline, enumConstantOutline, - options, errorHandler); - } - - } - - protected void processClassOutline(ClassOutline classOutline, - Options options, ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - - annotateClassOutline(classOutline.ref.owner(), classOutline, - customizations, errorHandler); - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - processFieldOutline(classOutline, fieldOutline, options, - errorHandler); - } - - } - - private void processFieldOutline(ClassOutline classOutline, - FieldOutline fieldOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - annotate(fieldOutline.parent().ref.owner(), fieldOutline, - customizations, errorHandler); - } - - private void processEnumConstantOutline(EnumOutline enumOutline, - EnumConstantOutline enumConstantOutline, Options options, - ErrorHandler errorHandler) { - - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumConstantOutline); - - annotateEnumConstantOutline(enumOutline.parent().getCodeModel(), - enumConstantOutline, customizations, errorHandler); - } - - protected void annotateElementOutline(final JCodeModel codeModel, - final ElementOutline elementOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ELEMENT_QNAME.equals(name)) { - - final JAnnotatable annotatable = elementOutline.implClass; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotateEnumOutline(final JCodeModel codeModel, - final EnumOutline enumOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ENUM_QNAME.equals(name)) { - - final JAnnotatable annotatable = enumOutline.clazz; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotateEnumConstantOutline(final JCodeModel codeModel, - final EnumConstantOutline enumConstantOutline, - final CCustomizations customizations, - final ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_ENUM_CONSTANT_QNAME.equals(name)) { - - final JAnnotatable annotatable = enumConstantOutline.constRef; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - - } - } - } - } - - protected void annotateClassOutline(final JCodeModel codeModel, - final ClassOutline classOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - - customization.markAsAcknowledged(); - if (ANNOTATE_CLASS_QNAME.equals(name) - || ANNOTATE_QNAME.equals(name)) { - - final JAnnotatable annotatable = classOutline.ref; - - annotate(codeModel, errorHandler, customization, element, - annotatable); - } - } - } - } - - protected void annotate(final JCodeModel codeModel, - final FieldOutline fieldOutline, - final CCustomizations customizations, ErrorHandler errorHandler) { - for (final CPluginCustomization customization : customizations) { - final Element element = customization.element; - final QName name = new QName(element.getNamespaceURI(), - element.getLocalName()); - if (Constants.NAMESPACE_URI.equals(name.getNamespaceURI())) { - customization.markAsAcknowledged(); - customization.markAsAcknowledged(); - if (ANNOTATE_QNAME.equals(name) - || ANNOTATE_PROPERTY_QNAME.equals(name)) { - - final JAnnotatable annotatable; - - final String draftTarget = element.getAttribute("target"); - - final String target; - - if (draftTarget == null || "".equals(draftTarget)) { - target = getDefaultFieldTarget(); - } else { - target = draftTarget; - } - - if ("class".equals(target)) { - annotatable = fieldOutline.parent().ref; - } else if ("getter".equals(target)) { - final JMethod _getter = FieldAccessorUtils - .getter(fieldOutline); - if (_getter == null) { - logger.error(MessageFormat - .format("Could not annotate the getter of the field outline [{0}], getter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - - } - annotatable = _getter; - } else if ("setter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - if (_setter == null) { - logger.error(MessageFormat - .format("Could not annotate the setter of the field outline [{0}], setter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - } - annotatable = _setter; - } else if ("setter-parameter".equals(target)) { - final JMethod _setter = FieldAccessorUtils - .setter(fieldOutline); - - if (_setter == null) { - logger.error(MessageFormat - .format("Could not annotate the setter parameter of the field outline [{0}], setter method could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - annotatable = null; - } else { - final JVar[] params = _setter.listParams(); - if (params.length != 1) { - logger.error(MessageFormat - .format("Could not annotate the setter parameter of the field outline [{0}], setter method must have a single parameter(this setter has {1}).", - - OutlineUtils - .getFieldName(fieldOutline), - params.length)); - annotatable = null; - } else { - annotatable = FieldAccessorUtils.setter( - fieldOutline).listParams()[0]; - } - } - } else if ("field".equals(target)) { - // Ok - final JFieldVar _field = FieldAccessorUtils - .field(fieldOutline); - if (_field == null) { - logger.error(MessageFormat - .format("Could not annotate the field of the field outline [{0}] since it could not be found.", - - OutlineUtils.getFieldName(fieldOutline))); - } - annotatable = _field; - - } else { - logger.error("Invalid annotation target [" + target - + "]."); - annotatable = null; - } - - if (annotatable != null) { - - annotate(codeModel, errorHandler, customization, - element, annotatable); - } - } - } - } - } - - private void annotate(final JCodeModel codeModel, - ErrorHandler errorHandler, - final CPluginCustomization customization, final Element element, - final JAnnotatable annotatable) { - final NodeList elements = element.getChildNodes(); - for (int index = 0; index < elements.getLength(); index++) { - final Node node = elements.item(index); - if (node.getNodeType() == Node.ELEMENT_NODE) { - final Element child = (Element) node; - - try { - final XAnnotation annotation = getAnnotationParser().parse( - child); - getAnnotator().annotate(codeModel, annotatable, annotation); - } catch (Exception ex) { - try { - errorHandler.error(new SAXParseException( - "Error parsing annotation.", - customization.locator, ex)); - } catch (SAXException ignored) { - // Nothing to do - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(ANNOTATE_QNAME, ANNOTATE_CLASS_QNAME, - ANNOTATE_ELEMENT_QNAME, ANNOTATE_PROPERTY_QNAME); - } - -} diff --git a/basics/tags/0.6.5/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java b/basics/tags/0.6.5/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java deleted file mode 100644 index 2eacc503..00000000 --- a/basics/tags/0.6.5/annotate/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java +++ /dev/null @@ -1,314 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate; - -import java.lang.reflect.Field; -import java.util.Collection; -import java.util.List; - -import org.jvnet.annox.model.XAnnotation; -import org.jvnet.annox.model.XAnnotationField; -import org.jvnet.annox.model.XAnnotationField.XAnnotationArray; -import org.jvnet.annox.model.XAnnotationField.XBoolean; -import org.jvnet.annox.model.XAnnotationField.XBooleanArray; -import org.jvnet.annox.model.XAnnotationField.XByte; -import org.jvnet.annox.model.XAnnotationField.XByteArray; -import org.jvnet.annox.model.XAnnotationField.XChar; -import org.jvnet.annox.model.XAnnotationField.XCharArray; -import org.jvnet.annox.model.XAnnotationField.XClass; -import org.jvnet.annox.model.XAnnotationField.XClassArray; -import org.jvnet.annox.model.XAnnotationField.XDouble; -import org.jvnet.annox.model.XAnnotationField.XDoubleArray; -import org.jvnet.annox.model.XAnnotationField.XEnum; -import org.jvnet.annox.model.XAnnotationField.XEnumArray; -import org.jvnet.annox.model.XAnnotationField.XFloat; -import org.jvnet.annox.model.XAnnotationField.XFloatArray; -import org.jvnet.annox.model.XAnnotationField.XInt; -import org.jvnet.annox.model.XAnnotationField.XIntArray; -import org.jvnet.annox.model.XAnnotationField.XLong; -import org.jvnet.annox.model.XAnnotationField.XLongArray; -import org.jvnet.annox.model.XAnnotationField.XShort; -import org.jvnet.annox.model.XAnnotationField.XShortArray; -import org.jvnet.annox.model.XAnnotationField.XString; -import org.jvnet.annox.model.XAnnotationField.XStringArray; -import org.jvnet.annox.model.XAnnotationVisitor; -import org.jvnet.jaxb2_commons.util.CodeModelUtils; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationArrayMember; -import com.sun.codemodel.JAnnotationUse; -import com.sun.codemodel.JAnnotationValue; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JFormatter; -import com.sun.codemodel.JType; - -public class Annotator { - - public static final Annotator INSTANCE = new Annotator(); - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - Collection xannotations) { - for (final XAnnotation xannotation : xannotations) { - if (xannotation != null) { - annotate(codeModel, annotatable, xannotation); - } - } - } - - public void annotate(JCodeModel codeModel, JAnnotatable annotatable, - XAnnotation xannotation) { - final JClass annotationClass = codeModel.ref(xannotation - .getAnnotationClass()); - JAnnotationUse annotationUse = null; - for (JAnnotationUse annotation : annotatable.annotations()) { - if (annotationClass.equals(annotation.getAnnotationClass())) { - annotationUse = annotation; - } - } - if (annotationUse == null) { - annotationUse = annotatable.annotate(annotationClass); - } - final XAnnotationVisitor visitor = createAnnotationFieldVisitor( - codeModel, annotationUse); - xannotation.accept(visitor); - - } - - protected XAnnotationVisitor createAnnotationFieldVisitor( - JCodeModel codeModel, final JAnnotationUse annotationUse) { - final XAnnotationVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return visitor; - } - - public static class AnnotatingFieldVisitor implements - XAnnotationVisitor { - - protected final JCodeModel codeModel; - - protected final JAnnotationUse use; - - public AnnotatingFieldVisitor(final JCodeModel codeModel, - final JAnnotationUse use) { - this.codeModel = codeModel; - this.use = use; - } - - public JAnnotationUse visitAnnotation(XAnnotation annotation) { - for (final XAnnotationField field : annotation.getFieldsList()) { - field.accept(this); - } - return use; - } - - public JAnnotationUse visitBooleanField(XBoolean field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitByteField(XByte field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitCharField(XChar field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitClassField(XClass field) { - JType type = CodeModelUtils.ref(codeModel, field.getClassName()); - return use.param(field.getName(), type); - } - - public JAnnotationUse visitDoubleField(XDouble field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitEnumField(XEnum field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitFloatField(XFloat field) { - // TODO: patch code model - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitIntField(XInt field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitLongField(XLong field) { - return use.param(field.getName(), field.getValue().intValue()); - } - - public JAnnotationUse visitShortField(XShort field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitStringField(XString field) { - return use.param(field.getName(), field.getValue()); - } - - public JAnnotationUse visitBooleanArrayField(XBooleanArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Boolean value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitByteArrayField(XByteArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Byte value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitCharArrayField(XCharArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Character value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitClassArrayField(XClassArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final String className : field.getClassNames()) { - final JType type = CodeModelUtils.ref(codeModel, className); - array.param(type); - } - return use; - } - - public JAnnotationUse visitDoubleArrayField(XDoubleArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Double value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitEnumArrayField(XEnumArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - for (final Enum value : field.getValue()) { - - final JAnnotationValue annotationValue = new JAnnotationValue() { - public void generate(JFormatter f) { - f.t(codeModel.ref(value.getDeclaringClass())).p('.') - .p(value.name()); - } - }; - - addParam(array, annotationValue); - } - return use; - } - - @SuppressWarnings("unchecked") - public void addParam(final JAnnotationArrayMember array, - JAnnotationValue annotationValue) { - try { - final Field values = JAnnotationArrayMember.class - .getDeclaredField("values"); - values.setAccessible(true); - ((List) values.get(array)) - .add(annotationValue); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - public JAnnotationUse visitFloatArrayField(XFloatArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Float value : field.getValue()) { - // TODO - array.param(value.intValue()); - } - return use; - } - - public JAnnotationUse visitIntArrayField(XIntArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Integer value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitShortArrayField(XShortArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Short value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitStringArrayField(XStringArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final String value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationArrayField(XAnnotationArray field) { - - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - - final XAnnotation[] annotations = field.getValue(); - for (final XAnnotation annotation : annotations) { - - final JAnnotationUse annotationUse = array.annotate(annotation - .getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - - annotation.accept(visitor); - - } - return use; - } - - public JAnnotationUse visitLongArrayField(XLongArray field) { - final JAnnotationArrayMember array = use - .paramArray(field.getName()); - for (final Long value : field.getValue()) { - array.param(value); - } - return use; - } - - public JAnnotationUse visitAnnotationField( - org.jvnet.annox.model.XAnnotationField.XAnnotation field) { - final JAnnotationUse annotationUse = use.annotationParam( - field.getName(), field.getAnnotationClass()); - - final AnnotatingFieldVisitor visitor = new AnnotatingFieldVisitor( - codeModel, annotationUse); - return field.getValue().accept(visitor); - } - - } - -} diff --git a/basics/tags/0.6.5/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.5/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 7f3c247c..00000000 --- a/basics/tags/0.6.5/annotate/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin \ No newline at end of file diff --git a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java b/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java deleted file mode 100644 index 0d06742d..00000000 --- a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface A { - long longField(); - - int intField(); - - short shortField(); - - char charField(); - - byte byteField(); - - double doubleField(); - - float floatField(); - - boolean booleanField(); - - String stringField(); - - E enumField(); - - Class classField(); - - B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java b/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java deleted file mode 100644 index 9f27a8d4..00000000 --- a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface B { - - long[] longArrayField(); - - int[] intArrayField(); - - short[] shortArrayField(); - - char[] charArrayField(); - - byte[] byteArrayField(); - - double[] doubleArrayField(); - - float[] floatArrayField(); - - boolean[] booleanArrayField(); - - String[] stringArrayField(); - - E[] enumArrayField(); - - Class[] classArrayField(); - - B.C[] annotationArrayField(); - - @Retention(RetentionPolicy.RUNTIME) - public static @interface C { - } -} \ No newline at end of file diff --git a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java b/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java deleted file mode 100644 index 4eae4782..00000000 --- a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface D { - -} diff --git a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java b/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java deleted file mode 100644 index f8e7b4e5..00000000 --- a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -public enum E { - - ONE, TWO, THREE, FOUR; - -} \ No newline at end of file diff --git a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java b/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java deleted file mode 100644 index fd8d8c21..00000000 --- a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface F { - String value(); - -} diff --git a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java b/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java deleted file mode 100644 index 106f53db..00000000 --- a/basics/tags/0.6.5/annotate/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/RunPluginTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.annotate.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.project.MavenProject; -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunPluginTest extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setProject(new MavenProject()); - mojo.setForceRegenerate(true); - mojo.setExtension(true); - - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } -} diff --git a/basics/tags/0.6.5/annotate/src/test/resources/schema.xsd b/basics/tags/0.6.5/annotate/src/test/resources/schema.xsd deleted file mode 100644 index 79a863a0..00000000 --- a/basics/tags/0.6.5/annotate/src/test/resources/schema.xsd +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - 16 - 17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/ant/.classpath b/basics/tags/0.6.5/ant/.classpath deleted file mode 100644 index 9c865fb7..00000000 --- a/basics/tags/0.6.5/ant/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.5/ant/.project b/basics/tags/0.6.5/ant/.project deleted file mode 100644 index 63b92b0b..00000000 --- a/basics/tags/0.6.5/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/ant/pom.xml b/basics/tags/0.6.5/ant/pom.xml deleted file mode 100644 index 813ff729..00000000 --- a/basics/tags/0.6.5/ant/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.5/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.6.5/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.6.5/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.6.5/basic/.classpath b/basics/tags/0.6.5/basic/.classpath deleted file mode 100644 index ee6d2357..00000000 --- a/basics/tags/0.6.5/basic/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.5/basic/.project b/basics/tags/0.6.5/basic/.project deleted file mode 100644 index 9ef5e932..00000000 --- a/basics/tags/0.6.5/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/basic/pom.xml b/basics/tags/0.6.5/basic/pom.xml deleted file mode 100644 index 4bc20345..00000000 --- a/basics/tags/0.6.5/basic/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.6.5 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - com.google.code.javaparser - javaparser - 1.0.8 - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.felix - - - maven-bundle-plugin - - - [2.3.7,) - - - manifest - - - - - - - - - - org.jvnet.jaxb2.maven2 - - - maven-jaxb2-plugin - - - [0.8.1,) - - - generate - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 176f243b..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(EnumOutline enumOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 0d007353..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(EnumOutline enumOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index 78a9987f..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,337 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String copyStrategyClass = JAXBCopyStrategy.class.getName(); - - public void setCopyStrategyClass(final String copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public String getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, codeModel - .ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, codeModel - .ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl(JMod.FINAL, theClass.owner().ref( - Object.class), "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), JExpr - .invoke("createNewInstance"), target)); - } else { - body - ._if(JExpr._null().eq(target)) - ._then() - ._throw( - JExpr - ._new( - theClass - .owner() - .ref( - IllegalArgumentException.class)) - .arg( - "Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator).arg( - draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", JExpr - .cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr.invoke( - copyStrategy, "copy").arg( - theClass.owner().ref(LocatorUtils.class) - .staticInvoke("property").arg(locator) - .arg( - fieldOutline.getPropertyInfo() - .getName(false)).arg( - sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), copyFieldType - .isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java deleted file mode 100644 index 0b550431..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/enumvalue"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java deleted file mode 100644 index 177a950c..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.EnumValue; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EnumValuePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XenumValue"; - } - - @Override - public String getUsage() { - return "Forces generated @XmlEnums implement the org.jvnet.jaxb2_commons.lang.EnumValue interface."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final EnumOutline enumOutline : outline.getEnums()) { - if (!getIgnoring().isIgnored(enumOutline)) { - processEnumOutline(enumOutline); - } - } - return true; - } - - protected void processEnumOutline(EnumOutline enumOutline) { - CEnumLeafInfo enumLeafInfo = enumOutline.target; - JClass enumType = enumLeafInfo.base.toType(enumOutline.parent(), - Aspect.EXPOSED).boxify(); - - final JDefinedClass theClass = enumOutline.clazz; - - ClassUtils._implements(theClass, theClass.owner().ref(EnumValue.class) - .narrow(enumType)); - - final JMethod enumValue$enumValue = theClass.method(JMod.PUBLIC, - enumType, "enumValue"); - enumValue$enumValue.body()._return(JExpr._this().invoke("value")); - } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 5d35be2b..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); - - public void setEqualsStrategyClass(String equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public String getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - // - // @SuppressWarnings("unused") - // final JMethod equals$equals = generateEquals$equals(enumOutline, - // theClass); - // } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } - - // protected JMethod generateEquals$equals(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // final JCodeModel codeModel = theClass.owner(); - // final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - // "equals"); - // - // { - // final JBlock body = equals.body(); - // final JVar leftLocator = equals.param(ObjectLocator.class, - // "thisLocator"); - // final JVar rightLocator = equals.param(ObjectLocator.class, - // "thatLocator"); - // final JVar object = equals.param(Object.class, "object"); - // final JVar equalsStrategy = equals.param(EqualsStrategy.class, - // "strategy"); - // - // body._return(equalsStrategy - // .invoke("equals") - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(leftLocator) - // .arg("value").arg(JExpr._this().ref("value"))) - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(rightLocator) - // .arg("value").arg(object.ref("value"))) - // .arg(JExpr._this().ref("value")).arg(object.ref("value"))); - // - // } - // return equals; - // } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index 571b6fbe..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); - - public void setHashCodeStrategyClass(String hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public String getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - // - // // @SuppressWarnings("unused") - // // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode = generateHashCode$hashCode( - // enumOutline, theClass); - // // @SuppressWarnings("unused") - // // final JMethod object$hashCode = generateObject$hashCode(enumOutline, - // // theClass); - // } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - return generateObject$hashCode(theClass); - } - - // protected JMethod generateObject$hashCode(final EnumOutline enumOutline, - // final JDefinedClass theClass) { - // return generateObject$hashCode(theClass); - // } - - private JMethod generateObject$hashCode(final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, - theClass.owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass - .owner().ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl( - fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign( - currentHashCode, - hashCodeStrategy - .invoke("hashCode") - .arg(codeModel - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(theValue)) - .arg(currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } - - // protected JMethod generateHashCode$hashCode(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // JCodeModel codeModel = theClass.owner(); - // final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - // codeModel.INT, "hashCode"); - // final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - // "locator"); - // final JVar hashCodeStrategy = hashCode$hashCode.param( - // HashCodeStrategy.class, "strategy"); - // final JBlock body = hashCode$hashCode.body(); - // - // body._return(hashCodeStrategy - // .invoke("hashCode") - // .arg(codeModel.ref(LocatorUtils.class).staticInvoke("property") - // .arg(locator).arg("value") - // .arg(JExpr._this().ref("value"))).arg(JExpr.lit(1)) - // .arg(JExpr._this().ref("value"))); - // - // return hashCode$hashCode; - // } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index 0d8c96ec..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIEnum; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - final Map knownClasses = new HashMap(); - final Map knownClassInfos = new IdentityHashMap(); - - for (final ClassOutline classOutline : outline.getClasses()) { - knownClasses.put(classOutline.implClass.fullName(), - classOutline.implClass); - knownClassInfos.put(classOutline.implClass, classOutline.target); - } - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, knownClasses, knownClassInfos); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, knownClasses); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, knownClasses); - } - } - processPackageOutlines(outline, knownClasses); - return true; - } - - private void processClassOutline(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - - generateExtends(classOutline, knownClasses, knownClassInfos); - generateImplements(classOutline, knownClasses); - - } - - private void processEnumOutline(EnumOutline enumOutline, - Map knownClasses) { - - generateExtends(enumOutline, knownClasses); - generateImplements(enumOutline, knownClasses); - - } - - private void processElementOutline(ElementOutline elementOutline, - Map knownClasses) { - - generateExtends(elementOutline, knownClasses); - generateImplements(elementOutline, knownClasses); - - } - - private void processPackageOutlines(Outline outline, - Map knownClasses) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass, - knownClasses); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface, knownClasses); - } - } - } - } - } - } - } - } - - private JClass generateExtends(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - JClass targetClass = generateExtends(theClass, - extendsClassCustomization, knownClasses); - - final CClassInfo classInfo = classOutline.target; - if (targetClass != null && classInfo.getBaseClass() == null - && classInfo.getRefBaseClass() == null) { - final CClassInfo targetClassInfo = knownClassInfos.get(targetClass); - if (targetClassInfo == null && classInfo.getRefBaseClass() == null) { - final Model model = classInfo.model; - // BIEnum as BIClass is protected too much - final BIEnum decl = new BIEnum(); - decl.ref = targetClass.fullName(); - final CClassRef baseClass = new CClassRef(model, - classInfo.getSchemaComponent(), decl, - new CCustomizations()); - classInfo.setBaseClass(baseClass); - } else if (targetClassInfo != null - && classInfo.getBaseClass() == null) { - classInfo.setBaseClass(targetClassInfo); - } - } - return targetClass; - } - - private JClass generateExtends(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization, - Map knownClasses) throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - return generateExtends(theClass, extendsClass, knownClasses); - } else { - return null; - } - } - - private JClass generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass, Map knownClasses) { - if (extendsClass.getClassName() != null) { - final String _class = extendsClass.getClassName(); - final JClass targetClass = parseClass(_class, theClass.owner(), - knownClasses); - theClass._extends(targetClass); - return targetClass; - } else { - return null; - } - } - - private List generateImplements(ClassOutline classOutline, - Map knownClasses) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations, - Map knownClasses) throws AssertionError { - final List implementedInterfaces = new ArrayList( - implementsInterfaceCustomizations.size()); - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - - final JClass implementedInterface = generateImplements( - theClass, implementsInterface, knownClasses); - if (implementedInterface != null) { - implementedInterfaces.add(implementedInterface); - } - } - } - return implementedInterfaces; - } - - private JClass generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface, - Map knownClasses) { - - String _interface = implementsInterface.getInterfaceName(); - if (_interface != null) { - final JClass targetClass = parseClass(_interface, theClass.owner(), - knownClasses); - theClass._implements(targetClass); - return targetClass; - } else { - return null; - } - } - - private JClass parseClass(String _class, JCodeModel codeModel, - Map knownClasses) { - return new JavaTypeParser(knownClasses).parseClass(_class, codeModel); - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java deleted file mode 100644 index 8111d999..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.JavaParser; -import japa.parser.ParseException; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class JavaTypeParser { - - static { - JavaParser.setCacheParser(false); - } - - private final TypeToJTypeConvertingVisitor typeToJTypeConvertingVisitor; - - public JavaTypeParser() { - this(Collections. emptyMap()); - } - - public JavaTypeParser(Map knownClasses) { - Validate.notNull(knownClasses); - this.typeToJTypeConvertingVisitor = new TypeToJTypeConvertingVisitor( - knownClasses); - - } - - public JClass parseClass(String _class, JCodeModel codeModel) { - JType type = parseType(_class, codeModel); - if (type instanceof JClass) { - return (JClass) type; - } else { - throw new IllegalArgumentException("Type [" + _class - + "] is not a class."); - } - } - - private JType parseType(String type, JCodeModel codeModel) { - final String text = "public class Ignored extends " + type + " {}"; - try { - CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - final List _extended = classDeclaration - .getExtends(); - final ClassOrInterfaceType classOrInterfaceType = _extended.get(0); - - return classOrInterfaceType.accept( - this.typeToJTypeConvertingVisitor, codeModel); - } catch (ParseException pex) { - throw new IllegalArgumentException( - "Could not parse the type definition [" + type + "].", pex); - } catch (UnsupportedEncodingException uex) { - throw new UnsupportedOperationException(uex); - } - } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java deleted file mode 100644 index ff47848c..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; -import japa.parser.ast.visitor.GenericVisitorAdapter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class TypeToJTypeConvertingVisitor extends - GenericVisitorAdapter { - - private final Map knownClasses; - - public TypeToJTypeConvertingVisitor(Map knownClasses) { - Validate.notNull(knownClasses); - this.knownClasses = knownClasses; - } - - @Override - public JType visit(VoidType type, JCodeModel codeModel) { - return codeModel.VOID; - } - - @Override - public JType visit(PrimitiveType type, JCodeModel codeModel) { - switch (type.getType()) { - case Boolean: - return codeModel.BOOLEAN; - case Char: - return codeModel.CHAR; - case Byte: - return codeModel.BYTE; - case Short: - return codeModel.SHORT; - case Int: - return codeModel.INT; - case Long: - return codeModel.LONG; - case Float: - return codeModel.FLOAT; - case Double: - return codeModel.DOUBLE; - default: - throw new AssertionError("Unknown primitive type [" - + type.getType() + "]"); - } - } - - @Override - public JType visit(ReferenceType type, JCodeModel codeModel) { - final JType referencedType = type.getType().accept(this, codeModel); - - JType referencedTypeArray = referencedType; - for (int index = 0; index < type.getArrayCount(); index++) { - referencedTypeArray = referencedTypeArray.array(); - } - return referencedTypeArray; - } - - @Override - public JType visit(WildcardType type, JCodeModel codeModel) { - - if (type.getExtends() != null) { - final ReferenceType _extends = type.getExtends(); - final JType boundType = _extends.accept(this, codeModel); - - if (!(boundType instanceof JClass)) { - throw new IllegalArgumentException("Bound type [" + _extends - + "]in the wildcard type must be class."); - } - - final JClass boundClass = (JClass) boundType; - return boundClass.wildcard(); - } else if (type.getSuper() != null) { - // TODO - throw new IllegalArgumentException( - "Wildcard types with super clause are not supported at the moment."); - } else { - throw new IllegalArgumentException( - "Wildcard type must have either extends or super clause."); - } - } - - @Override - public JType visit(ClassOrInterfaceType type, JCodeModel codeModel) { - final String name = getName(type); - final JClass knownClass = this.knownClasses.get(name); - final JClass jclass = knownClass != null ? knownClass : codeModel - .ref(name); - final List typeArgs = type.getTypeArgs(); - if (typeArgs == null || typeArgs.isEmpty()) { - return jclass; - } else { - final List jtypeArgs = new ArrayList( - typeArgs.size()); - for (Type typeArg : typeArgs) { - final JType jtype = typeArg.accept(this, codeModel); - if (!(jtype instanceof JClass)) { - throw new IllegalArgumentException("Type argument [" - + typeArg.toString() + "] is not a class."); - } else { - jtypeArgs.add((JClass) jtype); - } - } - return jclass.narrow(jtypeArgs); - } - } - - private String getName(ClassOrInterfaceType type) { - final String name = type.getName(); - final ClassOrInterfaceType scope = type.getScope(); - if (scope == null) { - return name; - } else { - return getName(scope) + "." + name; - } - } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index c83e1901..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); - - public void setMergeStrategyClass( - final String mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public String getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index d94d6a45..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - public static enum Mode { - - accessor { - - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(setter.body()); - accessor.fromRawValue(setter.body(), "draft", value); - } - }, - direct { - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - - final JFieldVar field = theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - - if (field != null) { - setter.body().assign(JExpr._this().ref(field), value); - } else { - // Fallback to the accessor - Mode.accessor.generateSetter(fieldOutline, theClass, - setter, value); - } - } - }; - public abstract void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value); - } - - private Mode mode = Mode.accessor; - - public String getMode() { - return mode.name(); - - } - - public void setMode(String mode) { - Validate.notNull(mode); - try { - this.mode = Mode.valueOf(mode); - } catch (IllegalArgumentException iaex) { - throw new IllegalArgumentException( - "Unsupported mode [" - + mode - + "]." - + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" - + " and [direct] (assigns the value to the field directly)."); - } - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - - mode.generateSetter(fieldOutline, theClass, - generatedSetter, value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java deleted file mode 100644 index 783cf37b..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - - public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-element-property"); - - public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-reference-property"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java deleted file mode 100644 index 97de9dd7..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeRef; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.ID; - -public class SimplifyPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xsimplify"; - } - - @Override - public String getUsage() { - return "This plugin allows simplifying \"complex\" properties" - + " (ex. aOrBOrC generated from repeatable choices)" - + " into several \"simple\" properties (ex. a, b, c).\n" - + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" - + " for plugin documentation."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public void postProcessModel(final Model model, ErrorHandler errorHandler) { - - for (final CClassInfo classInfo : model.beans().values()) { - postProcessClassInfo(model, classInfo); - } - } - - private void postProcessClassInfo(final Model model, - final CClassInfo classInfo) { - final List properties = new ArrayList( - classInfo.getProperties()); - for (CPropertyInfo property : properties) { - property.accept(new CPropertyVisitor() { - - public Void onElement(CElementPropertyInfo elementProperty) { - postProcessElementPropertyInfo(model, classInfo, - elementProperty); - return null; - } - - public Void onAttribute(CAttributePropertyInfo attributeProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onValue(CValuePropertyInfo valueProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onReference(CReferencePropertyInfo p) { - postProcessReferencePropertyInfo(model, classInfo, p); - return null; - } - - }); - } - } - - private void postProcessElementPropertyInfo(final Model model, - final CClassInfo classInfo, CElementPropertyInfo property) { - if (property.isCollection() && property.getTypes().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyElementPropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } - } - } - - private void postProcessReferencePropertyInfo(final Model model, - final CClassInfo classInfo, CReferencePropertyInfo property) { - if (property.isCollection() && property.getElements().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } else if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsReferencePropertyInfo(model, - classInfo, property); - } - } - } - - private void simplifyElementPropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CElementPropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CTypeRef typeRef : property.getTypes()) { - final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( - model, property, typeRef); - classInfo.getProperties().add(index++, elementPropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsReferencePropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( - model, property, element); - classInfo.getProperties().add(index++, referencePropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CElementPropertyInfo elementPropertyInfo; - if (element instanceof CElementInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CElementInfo) element); - } else if (element instanceof CClassInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CClassInfo) element); - - } else if (element instanceof CClassRef) { - // elementPropertyInfo = createElementPropertyInfo(model, - // element, - // (CClassRef) element); - elementPropertyInfo = null; - // TODO WARN - - } else { - // TODO WARN - elementPropertyInfo = null; - } - if (elementPropertyInfo != null) { - classInfo.getProperties().add(index++, elementPropertyInfo); - } - } - classInfo.getProperties().remove(property); - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CElementInfo elementInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(elementInfo.getContentType(), element - .getElementName(), elementInfo.getContentType() - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CClassInfo classInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(classInfo, element.getElementName(), classInfo - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - // private CElementPropertyInfo createElementPropertyInfo(final Model model, - // CElement element, final CClassRef cr) { - // final CElementPropertyInfo elementPropertyInfo; - // final String propertyName = createPropertyName(model, element); - // elementPropertyInfo = new CElementPropertyInfo(propertyName, - // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - // element.getSchemaComponent(), element.getCustomizations(), - // element.getLocator(), false); - // elementPropertyInfo.getTypes().add( - // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), - // false, null)); - // return elementPropertyInfo; - // } - - private CReferencePropertyInfo createReferencePropertyInfo( - final Model model, CReferencePropertyInfo property, CElement element) { - final String propertyName = createPropertyName(model, element); - final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( - propertyName, true, false, property.isMixed(), - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), property.isDummy(), property.isContent(), - property.isMixedExtendedCust()); - referencePropertyInfo.getElements().add(element); - return referencePropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElementPropertyInfo property, CTypeRef typeRef) { - final String propertyName = createPropertyName(model, typeRef); - boolean required = false; - final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( - propertyName, CollectionMode.REPEATED_ELEMENT, typeRef - .getTarget().idUse(), typeRef.getTarget() - .getExpectedMimeType(), property.getSchemaComponent(), - property.getCustomizations(), property.getLocator(), required); - elementPropertyInfo.getTypes().add(typeRef); - return elementPropertyInfo; - } - - private String createPropertyName(final Model model, CElement element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getElementName().getLocalPart()); - return propertyName; - } - - private String createPropertyName(final Model model, CTypeRef element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getTagName().getLocalPart()); - return propertyName; - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index dc8eac3c..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); - - public void setToStringStrategyClass( - String toStringStrategy) { - this.toStringStrategyClass = toStringStrategy; - } - - public String getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 6f95d0b1..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final String strategyClassName) { - - try { - final Class strategyClass = Class.forName(strategyClassName); - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } catch (ClassNotFoundException cnfex) { - final JClass strategyJClass = codeModel.ref(strategyClassName); - return JExpr._new(strategyJClass); - } - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index b44a1cb3..00000000 --- a/basics/tags/0.6.5/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - final boolean laxModel = CustomizationUtils.containsCustomization( - model, Customizations.LAX_ELEMENT_NAME); - final boolean skipModel = CustomizationUtils.containsCustomization( - model, Customizations.SKIP_ELEMENT_NAME); - final boolean strictModel = CustomizationUtils.containsCustomization( - model, Customizations.STRICT_ELEMENT_NAME); - for (CClassInfo classInfo : model.beans().values()) { - final boolean laxClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.STRICT_ELEMENT_NAME); - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - final boolean laxPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME); - - if (laxModel) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipModel) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictModel) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.6.5/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.6.5/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 99ef7147..00000000 --- a/basics/tags/0.6.5/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,13 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin -org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin -org.jvnet.jaxb2_commons.plugin.enumvalue.EnumValuePlugin \ No newline at end of file diff --git a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java b/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java deleted file mode 100644 index 30bdf587..00000000 --- a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; - -public class JavaParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final JavaTypeParser javaTypeParser = new JavaTypeParser(); - final JCodeModel codeModel = new JCodeModel(); - JClass comparator = javaTypeParser.parseClass("java.util.Comparator", - codeModel); - assertNotNull(comparator); - JClass integerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(integerComparator); - JClass wildcardIntegerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(wildcardIntegerComparator); - } -} diff --git a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java b/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java deleted file mode 100644 index a2562048..00000000 --- a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; - -import java.io.ByteArrayInputStream; -import java.util.List; - -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - assertEquals(1, typeDeclarations.size()); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - assertEquals("Dummy", classDeclaration.getName()); - final List implementedInterfaces = classDeclaration - .getImplements(); - assertEquals(1, implementedInterfaces.size()); - final ClassOrInterfaceType implementedInterface = implementedInterfaces - .get(0); - assertEquals("Comparator", implementedInterface.getName()); - final List typeArgs = implementedInterface.getTypeArgs(); - assertEquals(1, typeArgs.size()); - final Type typeArg = typeArgs.get(0); - assertTrue(typeArg instanceof ReferenceType); - final ReferenceType referenceTypeArg = (ReferenceType) typeArg; - final Type referencedType = referenceTypeArg.getType(); - assertTrue(referencedType instanceof ClassOrInterfaceType); - final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; - assertEquals("Integer", typeArgType.getName()); - - } -} diff --git a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.6.5/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.6.5/basic/src/test/resources/schema.xsd b/basics/tags/0.6.5/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.6.5/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/build-1.5.bat b/basics/tags/0.6.5/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.5/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.5/build-1.6.bat b/basics/tags/0.6.5/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.5/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.5/deploy.bat b/basics/tags/0.6.5/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/tags/0.6.5/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/tags/0.6.5/dist/pom.xml b/basics/tags/0.6.5/dist/pom.xml deleted file mode 100644 index 4f1df2be..00000000 --- a/basics/tags/0.6.5/dist/pom.xml +++ /dev/null @@ -1,164 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/dist - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - - diff --git a/basics/tags/0.6.5/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.6.5/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.6.5/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.5/dist/src/main/assembly/dist.xml b/basics/tags/0.6.5/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.6.5/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.6.5/install-1.5.bat b/basics/tags/0.6.5/install-1.5.bat deleted file mode 100644 index 24bfffb2..00000000 --- a/basics/tags/0.6.5/install-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.5/install-1.6.bat b/basics/tags/0.6.5/install-1.6.bat deleted file mode 100644 index cbb92aa4..00000000 --- a/basics/tags/0.6.5/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.5/install.bat b/basics/tags/0.6.5/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/tags/0.6.5/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/tags/0.6.5/jaxb/pom.xml b/basics/tags/0.6.5/jaxb/pom.xml deleted file mode 100644 index 2ad49ae7..00000000 --- a/basics/tags/0.6.5/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 7 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/jaxb/release.bat b/basics/tags/0.6.5/jaxb/release.bat deleted file mode 100644 index e6784200..00000000 --- a/basics/tags/0.6.5/jaxb/release.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn clean deploy -DperformRelease=true -Psonatype-oss-release \ No newline at end of file diff --git a/basics/tags/0.6.5/jaxb/xjc/pom.xml b/basics/tags/0.6.5/jaxb/xjc/pom.xml deleted file mode 100644 index a2a60692..00000000 --- a/basics/tags/0.6.5/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.4 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/pom.xml b/basics/tags/0.6.5/pom.xml deleted file mode 100644 index 08812a3d..00000000 --- a/basics/tags/0.6.5/pom.xml +++ /dev/null @@ -1,357 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.6.5 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - org.highsource.static.jaxb2-basics - ${sftp.static.highsource.org}/jaxb2-basics - - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/trunk - - - ant - runtime - tools - testing - basic - annotate - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - dist - - - dist - - - - dist - - - - - 2.2.5-2 - 0.8.2 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - org.jvnet.annox - annox - 0.5.0 - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb.version} - - - - junit - junit - 3.8.1 - - - - commons-lang - commons-lang - 2.2 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.6.5/release.bat b/basics/tags/0.6.5/release.bat deleted file mode 100644 index 51f33868..00000000 --- a/basics/tags/0.6.5/release.bat +++ /dev/null @@ -1,5 +0,0 @@ -rem update versions -mvn clean install -DperformRelease -Psamples -Ptests -Pdist -mvn scm:tag -Dtag=%1 -mvn -Psamples -Ptests -Pdist -DperformRelease -Psonatype-oss-release clean deploy -rem update versions \ No newline at end of file diff --git a/basics/tags/0.6.5/runtime/.classpath b/basics/tags/0.6.5/runtime/.classpath deleted file mode 100644 index ee6d2357..00000000 --- a/basics/tags/0.6.5/runtime/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.5/runtime/.project b/basics/tags/0.6.5/runtime/.project deleted file mode 100644 index 5bfa86f3..00000000 --- a/basics/tags/0.6.5/runtime/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/runtime/pom.xml b/basics/tags/0.6.5/runtime/pom.xml deleted file mode 100644 index a65949ec..00000000 --- a/basics/tags/0.6.5/runtime/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - - - bundle-manifest - process-classes - - manifest - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index d66a74b7..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,371 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else if (lhs instanceof Equals[]) { - return equalsInternal(leftLocator, rightLocator, (Equals[]) lhs, - (Equals[]) rhs); - } else if (lhs instanceof Enum[]) { - return equalsInternal(leftLocator, rightLocator, (Enum[]) lhs, - (Enum[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else if (lhs instanceof Enum) { - return equalsInternal(leftLocator, rightLocator, (Enum) lhs, (Enum) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum lhs, Enum rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals lhs, Equals rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - return lhs.equals(leftLocator, rightLocator, rhs, this); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals[] left, Equals[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum[] left, Enum[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index e54659cd..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else if (object instanceof HashCode[]) { - return hashCodeInternal(locator, hashCode, (HashCode[]) object); - } else if (object instanceof Enum[]) { - return hashCodeInternal(locator, hashCode, (Enum[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else if (value instanceof Enum) { - return hashCodeInternal(locator, hashCode, (Enum) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode object) { - if (object == null) { - return hashCode * iConstant; - } else { - return hashCode * iConstant + object.hashCode(locator, this); - } - } - - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java deleted file mode 100644 index 9e843b88..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public interface EnumValue { - - public T enumValue(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index a6c06704..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 88b3cce7..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - // Treat empty lists as nulls - if (list.isEmpty()) { - return super.hashCode(locator, hashCode, (Object) null); - } else { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 8407ab35..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - public String getPathAsString() { - final String stepAsString = getStepAsString(); - final ObjectLocator parentLocator = getParentLocator(); - return parentLocator == null ? stepAsString : parentLocator - .getPathAsString() + stepAsString; - } - - protected abstract String getStepAsString(); - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - - // public Object[] getMessageParameters() { - // return new Object[] { getObject() }; - // } - // - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() + ".messages")); - } - - // public int hashCode() { - // int hashCode = getObject().hashCode(); - // return hashCode; - // } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index ce0d32ff..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "[" + getIndex() + "]"; - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index 0484223a..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "." + getPropertyName(); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index ecd6fc3e..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return ""; - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 37aa8555..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * @return Path to this locator in string form; - */ - public String getPathAsString(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index b70b0faf..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MClassInfo getBaseTypeInfo(); - - public String getName(); - - public String getLocalName(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java deleted file mode 100644 index 1a673485..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomizable { - - public MCustomizations getCustomizations(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java deleted file mode 100644 index 3e32cc52..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomization { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java deleted file mode 100644 index b20537dc..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MCustomizations { - - public List getCustomizations(); - - public void addCustomization(MCustomization customization); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index eb91799e..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java deleted file mode 100644 index 4a43b435..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MID extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java deleted file mode 100644 index 49ca1c30..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREF extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java deleted file mode 100644 index 1f0b2084..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREFS extends MList { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 9e0b5b8c..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MCustomizable, - MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 26947454..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 6afbd3b0..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index 0d628be5..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitID(MID info) { - return null; - } - - public V visitIDREF(MIDREF info) { - return null; - } - - public V visitIDREFS(MIDREFS info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 98a86bc7..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo extends MCustomizable { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 91e31247..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor { - - public V visitList(MList info); - - public V visitID(MID info); - - public V visitIDREF(MIDREF info); - - public V visitIDREFS(MIDREFS info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - - public V visitClassInfo(MClassInfo info); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 6dd77b37..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - private final MCustomizations customizations = new CMCustomizations(); - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index d4934fce..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MClassInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MClassInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MClassInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java deleted file mode 100644 index 6e09ab64..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.w3c.dom.Element; - -public class CMCustomization implements MCustomization { - - private final Element element; - - public CMCustomization(Element element) { - this.element = element; - } - - public Element getElement() { - return element; - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java deleted file mode 100644 index c7bfa857..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; - -public class CMCustomizations implements MCustomizations { - - private final List customizations = new LinkedList(); - private final List unmodifiableCustomizations = Collections - .unmodifiableList(this.customizations); - - public List getCustomizations() { - return unmodifiableCustomizations; - } - - public void addCustomization(MCustomization customization) { - Validate.notNull(customization); - this.customizations.add(customization); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index 45644f54..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - QName elementName, MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index d25eb09e..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 6e1b9e66..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo, - MCustomizable { - - private final MEnumLeafInfoOrigin origin; - private final CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java deleted file mode 100644 index 5daa634c..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMID implements MID { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMID(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitID(this); - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java deleted file mode 100644 index 2eaeacde..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMIDREF implements MIDREF { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMIDREF(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREF(this); - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java deleted file mode 100644 index accf9d52..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMIDREFS extends CMList implements MIDREFS { - - public CMIDREFS(T targetType, MTypeInfo itemTypeInfo) { - super(targetType, itemTypeInfo); - } - - @Override - public String toString() { - return MessageFormat.format("IDREFS [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREFS(this); - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index a3bce0b4..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,501 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - - if (list) { - switch (id) { - case ID: - final MTypeInfo tid = new CMID(ti.getTargetType(), - ti); - return new CMList(createListType(tid.getTargetType()), - tid); - case IDREF: - return new CMIDREFS(createListType(ti.getTargetType()), - ti); - default: - return new CMList(createListType(ti.getTargetType()), ti); - } - } else { - switch (id) { - case ID: - return new CMID(ti.getTargetType(), ti); - case IDREF: - return new CMIDREF(ti.getTargetType(), ti); - default: - return ti; - } - } - - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - private MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()), - info.isElement() ? info.getElementName() : null); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract MPackageInfo getPackage(EI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getLocalName(info), - getTypeInfo(baseType), info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 1e50748c..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index e3ee1ebd..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final CMCustomizations customizations = new CMCustomizations(); - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 37af6535..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index 196a11bd..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo, - MCustomizable { - - private CMCustomizations customizations = new CMCustomizations(); - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index 5f9236b9..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - private final MCustomizations customizations = new CMCustomizations(); - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index 9c163223..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitID(MID info) { - return visitTypeInfo(info); - } - - public V visitIDREF(MIDREF info) { - return visitTypeInfo(info); - } - - public V visitIDREFS(MIDREFS info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java deleted file mode 100644 index 43c96d12..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -public class PackageInfoQNameAnalyzer { - - private final MModelInfo modelInfo; - - public PackageInfoQNameAnalyzer(MModelInfo modelInfo) { - Validate.notNull(modelInfo); - this.modelInfo = modelInfo; - } - - public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - counter.add(name.getNamespaceURI()); - } - - public void attribute(QName name) { - - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - } - - public void attribute(QName name) { - counter.add(name.getNamespaceURI()); - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - private void collectNamespaceURIs(MPackageInfo packageInfo, - final QNameCollector collector) { - for (MElementInfo elementInfo : modelInfo.getElementInfos()) { - if (elementInfo.getPackageInfo() == packageInfo) { - collector.element(elementInfo.getElementName()); - } - } - - final QNameCollectingPropertyInfoVisitor visitor = new QNameCollectingPropertyInfoVisitor( - collector); - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - if (classInfo.getPackageInfo() == packageInfo) { - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - propertyInfo.acceptPropertyInfoVisitor(visitor); - } - } - } - } - - private static class NamespaceURICounter { - private Map map = new HashMap(); - - public void add(String namespaceURI) { - final Integer count = map.get(namespaceURI); - if (count == null) { - map.put(namespaceURI, Integer.valueOf(1)); - } else { - map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); - } - } - - public String getMostUsedNamespaceURI() { - String namespaceURI = null; - int count = 0; - - for (Map.Entry e : map.entrySet()) { - final String currentNamespaceURI = e.getKey(); - final int currentCount = e.getValue(); - if (namespaceURI == null) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } else { - if (currentCount > count - || (currentCount == count && namespaceURI == null)) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } - } - } - - return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; - - } - - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java deleted file mode 100644 index 6729008e..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class QNameCollectingPropertyInfoVisitor implements - MPropertyInfoVisitor { - - private final QNameCollector collector; - - public QNameCollectingPropertyInfoVisitor(QNameCollector collector) { - Validate.notNull(collector); - this.collector = collector; - } - - public Void visitElementPropertyInfo(MElementPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementsPropertyInfo(MElementsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } - - public Void visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return null; - } - - public Void visitAttributePropertyInfo(MAttributePropertyInfo info) { - collector.attribute(info.getAttributeName()); - return null; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - return null; - } - - public Void visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java deleted file mode 100644 index 2bd50907..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -public interface QNameCollector { - - public void element(QName name); - - public void attribute(QName name); -} diff --git a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.6.5/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.6.5/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.6.5/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.6.5/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.6.5/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.6.5/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.6.5/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.6.5/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.6.5/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.6.5/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.6.5/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.6.5/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/annotate/pom.xml b/basics/tags/0.6.5/samples/annotate/pom.xml deleted file mode 100644 index 548c6c4a..00000000 --- a/basics/tags/0.6.5/samples/annotate/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate - pom - JAXB2 Basics - Sample [annotate] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.5 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - org.hibernate - hibernate-search - 4.1.1.Final - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/annotate/project-build.xml b/basics/tags/0.6.5/samples/annotate/project-build.xml deleted file mode 100644 index ad3e61df..00000000 --- a/basics/tags/0.6.5/samples/annotate/project-build.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/annotate/project-pom.xml b/basics/tags/0.6.5/samples/annotate/project-pom.xml deleted file mode 100644 index 28bcf196..00000000 --- a/basics/tags/0.6.5/samples/annotate/project-pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-annotate-maven - ${project.version} - jar - JAXB2 Basics - Sample [annotate-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - provided - - - org.hibernate - hibernate-search - 4.1.1.Final - provided - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${project.version} - - - - - - org.hibernate - hibernate-search - 4.1.1.Final - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.5/samples/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index 0a07b0ff..00000000 --- a/basics/tags/0.6.5/samples/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.5/samples/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.5/samples/annotate/src/main/resources/schema.xsd deleted file mode 100644 index d991150f..00000000 --- a/basics/tags/0.6.5/samples/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/basic/pom.xml b/basics/tags/0.6.5/samples/basic/pom.xml deleted file mode 100644 index 13645df5..00000000 --- a/basics/tags/0.6.5/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.5 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/basic/project-build.xml b/basics/tags/0.6.5/samples/basic/project-build.xml deleted file mode 100644 index d644ea8f..00000000 --- a/basics/tags/0.6.5/samples/basic/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/basic/project-pom.xml b/basics/tags/0.6.5/samples/basic/project-pom.xml deleted file mode 100644 index 2909b2d1..00000000 --- a/basics/tags/0.6.5/samples/basic/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/basic/src/main/assembly/src.xml b/basics/tags/0.6.5/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.6.5/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.6.5/samples/basic/src/main/java/.placeholder b/basics/tags/0.6.5/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.5/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.6.5/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.5/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.5/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.5/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.6.5/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.5/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/basic/src/test/samples/1.xml b/basics/tags/0.6.5/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.5/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.5/samples/modular-ant/pom.xml b/basics/tags/0.6.5/samples/modular-ant/pom.xml deleted file mode 100644 index 6cc2d576..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4-SNAPSHOT - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/modular-ant/project-build.xml b/basics/tags/0.6.5/samples/modular-ant/project-build.xml deleted file mode 100644 index a2fc3e3a..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.6.5/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.6.5/samples/modular-ant/src/main/java/.placeholder b/basics/tags/0.6.5/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.5/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.6.5/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.5/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.6.5/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.6.5/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.5/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.5/samples/po/pom.xml b/basics/tags/0.6.5/samples/po/pom.xml deleted file mode 100644 index 2c54fba5..00000000 --- a/basics/tags/0.6.5/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.5 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/po/project-build.xml b/basics/tags/0.6.5/samples/po/project-build.xml deleted file mode 100644 index a22717d7..00000000 --- a/basics/tags/0.6.5/samples/po/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/po/project-pom.xml b/basics/tags/0.6.5/samples/po/project-pom.xml deleted file mode 100644 index edf3ced9..00000000 --- a/basics/tags/0.6.5/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/po/src/main/java/.placeholder b/basics/tags/0.6.5/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.6.5/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.6.5/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.6.5/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.5/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.6.5/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.6.5/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.6.5/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.5/samples/po/src/test/resources/log4j.properties b/basics/tags/0.6.5/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.5/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/po/src/test/samples/po.xml b/basics/tags/0.6.5/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.6.5/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/pom.xml b/basics/tags/0.6.5/samples/pom.xml deleted file mode 100644 index aa332551..00000000 --- a/basics/tags/0.6.5/samples/pom.xml +++ /dev/null @@ -1,137 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - po - basic - annotate - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/samples - - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/samples/src/main/assembly/ant-src.xml b/basics/tags/0.6.5/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.6.5/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.6.5/samples/src/main/assembly/maven-src.xml b/basics/tags/0.6.5/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.6.5/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.6.5/testing/.classpath b/basics/tags/0.6.5/testing/.classpath deleted file mode 100644 index a8aec977..00000000 --- a/basics/tags/0.6.5/testing/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.5/testing/.project b/basics/tags/0.6.5/testing/.project deleted file mode 100644 index 4ead1953..00000000 --- a/basics/tags/0.6.5/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/testing/pom.xml b/basics/tags/0.6.5/testing/pom.xml deleted file mode 100644 index c8a79895..00000000 --- a/basics/tags/0.6.5/testing/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.5/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.6.5/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.6.5/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.6.5/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.6.5/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.6.5/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.6.5/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.6.5/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.6.5/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.6.5/testing/src/test/samples/1.xml b/basics/tags/0.6.5/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/tags/0.6.5/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.6.5/testing/src/test/samples/2.xml b/basics/tags/0.6.5/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/tags/0.6.5/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/annotate/.classpath b/basics/tags/0.6.5/tests/annotate/.classpath deleted file mode 100644 index 0f040a45..00000000 --- a/basics/tags/0.6.5/tests/annotate/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.5/tests/annotate/.project b/basics/tags/0.6.5/tests/annotate/.project deleted file mode 100644 index c98c1330..00000000 --- a/basics/tags/0.6.5/tests/annotate/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-annotate - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/tests/annotate/pom.xml b/basics/tags/0.6.5/tests/annotate/pom.xml deleted file mode 100644 index ac282bf9..00000000 --- a/basics/tags/0.6.5/tests/annotate/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-annotate - jar - JAXB2 Basics - Test [annotate] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - -Xannotate-defaultFieldTarget=setter - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.5/tests/annotate/src/main/resources/bindings.xjb b/basics/tags/0.6.5/tests/annotate/src/main/resources/bindings.xjb deleted file mode 100644 index 9bdaaf89..00000000 --- a/basics/tags/0.6.5/tests/annotate/src/main/resources/bindings.xjb +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/annotate/src/main/resources/schema.xsd b/basics/tags/0.6.5/tests/annotate/src/main/resources/schema.xsd deleted file mode 100644 index 45b8239e..00000000 --- a/basics/tags/0.6.5/tests/annotate/src/main/resources/schema.xsd +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java b/basics/tags/0.6.5/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java deleted file mode 100644 index c59125b0..00000000 --- a/basics/tags/0.6.5/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.annotate; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunAnnotatePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xannotate"); - return args; - } - -} diff --git a/basics/tags/0.6.5/tests/annox/.classpath b/basics/tags/0.6.5/tests/annox/.classpath deleted file mode 100644 index 464509f4..00000000 --- a/basics/tags/0.6.5/tests/annox/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/basics/tags/0.6.5/tests/annox/.project b/basics/tags/0.6.5/tests/annox/.project deleted file mode 100644 index edb8ceb5..00000000 --- a/basics/tags/0.6.5/tests/annox/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/tests/annox/annotations/.classpath b/basics/tags/0.6.5/tests/annox/annotations/.classpath deleted file mode 100644 index 0bfb90cc..00000000 --- a/basics/tags/0.6.5/tests/annox/annotations/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.6.5/tests/annox/annotations/.project b/basics/tags/0.6.5/tests/annox/annotations/.project deleted file mode 100644 index 20705668..00000000 --- a/basics/tags/0.6.5/tests/annox/annotations/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-annox-annotations - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/tests/annox/annotations/pom.xml b/basics/tags/0.6.5/tests/annox/annotations/pom.xml deleted file mode 100644 index 07f36206..00000000 --- a/basics/tags/0.6.5/tests/annox/annotations/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.5 - ../pom.xml - - jaxb2-basics-test-annox-annotations - jar - JAXB2 Basics - Test [annox-annotations] - diff --git a/basics/tags/0.6.5/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java b/basics/tags/0.6.5/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java deleted file mode 100644 index 8c21043b..00000000 --- a/basics/tags/0.6.5/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Alpha.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface Alpha { - long longField() default 1; - - int intField() default 2; - - short shortField() default 3; - - char charField() default 'f'; - - byte byteField() default 5; - - double doubleField() default 6.0; - - float floatField() default 7.0f; - - boolean booleanField() default true; - - Digits enumField() default Digits.EIGHT; - - String stringField() default "nine"; - - @SuppressWarnings("unchecked") - Class classField() default String.class; - - // B annotationField(); -} \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java b/basics/tags/0.6.5/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java deleted file mode 100644 index a8b4e3e7..00000000 --- a/basics/tags/0.6.5/tests/annox/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/test/annox/annotations/Digits.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package org.jvnet.jaxb2_commons.plugin.annotate.test.annox.annotations; - -public enum Digits { - - ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE; - -} \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/annox/pom.xml b/basics/tags/0.6.5/tests/annox/pom.xml deleted file mode 100644 index 8318d42a..00000000 --- a/basics/tags/0.6.5/tests/annox/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-annox - pom - JAXB2 Basics - Test [annox] - - annotations - schema - - - diff --git a/basics/tags/0.6.5/tests/annox/schema/pom.xml b/basics/tags/0.6.5/tests/annox/schema/pom.xml deleted file mode 100644 index 0af288a4..00000000 --- a/basics/tags/0.6.5/tests/annox/schema/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox - 0.6.5 - ../pom.xml - - jaxb2-basics-test-annox-schema - jar - JAXB2 Basics - Test [annox-schema] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-annox-annotations - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/annox/schema/src/main/resources/binding.xjb b/basics/tags/0.6.5/tests/annox/schema/src/main/resources/binding.xjb deleted file mode 100644 index 71117799..00000000 --- a/basics/tags/0.6.5/tests/annox/schema/src/main/resources/binding.xjb +++ /dev/null @@ -1,20 +0,0 @@ - - - jaxb:extensionBindingPrefixes="annox" - - - - - - 0 - 3 - - - - - diff --git a/basics/tags/0.6.5/tests/annox/schema/src/main/resources/schema.xsd b/basics/tags/0.6.5/tests/annox/schema/src/main/resources/schema.xsd deleted file mode 100644 index 7408ec40..00000000 --- a/basics/tags/0.6.5/tests/annox/schema/src/main/resources/schema.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - 0 - 3 - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/build-1.5.bat b/basics/tags/0.6.5/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.6.5/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/build-1.6.bat b/basics/tags/0.6.5/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.6.5/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/episodes/a/pom.xml b/basics/tags/0.6.5/tests/episodes/a/pom.xml deleted file mode 100644 index 1ecc7e02..00000000 --- a/basics/tags/0.6.5/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.5 - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.6.5/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.5/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.6.5/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.6.5/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.6.5/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.6.5/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.6.5/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/episodes/b/pom.xml b/basics/tags/0.6.5/tests/episodes/b/pom.xml deleted file mode 100644 index 3af0e3c9..00000000 --- a/basics/tags/0.6.5/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.6.5 - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.6.5/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.6.5/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.6.5/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.6.5/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.6.5/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.6.5/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.5/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.6.5/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.6.5/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/episodes/pom.xml b/basics/tags/0.6.5/tests/episodes/pom.xml deleted file mode 100644 index b816e2f1..00000000 --- a/basics/tags/0.6.5/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/ignoring/pom.xml b/basics/tags/0.6.5/tests/ignoring/pom.xml deleted file mode 100644 index 8a0cb404..00000000 --- a/basics/tags/0.6.5/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.5/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.6.5/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.6.5/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/issues/.classpath b/basics/tags/0.6.5/tests/issues/.classpath deleted file mode 100644 index fd1a8b60..00000000 --- a/basics/tags/0.6.5/tests/issues/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.5/tests/issues/.project b/basics/tags/0.6.5/tests/issues/.project deleted file mode 100644 index 444d922b..00000000 --- a/basics/tags/0.6.5/tests/issues/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/tests/issues/pom.xml b/basics/tags/0.6.5/tests/issues/pom.xml deleted file mode 100644 index d5ca5b1d..00000000 --- a/basics/tags/0.6.5/tests/issues/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -Xequals-equalsStrategyClass=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB42EqualsStrategy - -XhashCode - -Xcopyable - -Xmergeable - -Xmergeable-mergeStrategyClass=org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy - -Xinheritance - -Xsetters - -Xsetters-mode=direct - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - -Xannotate - -Xsimplify - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java deleted file mode 100644 index 77921c47..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { - - @Override - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { - // Quasi custom equals - return super.equals(leftLocator, rightLocator, lhs, rhs); - } else { - return super.equals(leftLocator, rightLocator, lhs, rhs); - } - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java b/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java deleted file mode 100644 index ff1fb59f..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB48Interface { - - public T getValue(); - -} diff --git a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java b/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java deleted file mode 100644 index 25d45a45..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB53ABaseClass { - -} diff --git a/basics/tags/0.6.5/tests/issues/src/main/resources/binding.xjb b/basics/tags/0.6.5/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 1672089b..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,24 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - - - - - - diff --git a/basics/tags/0.6.5/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.6.5/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 7b6e61a5..00000000 --- a/basics/tags/0.6.5/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB48Interface<java.lang.String> - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53ABaseClass - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53AType - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java deleted file mode 100644 index 746bc3b7..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB20Test extends TestCase { - - public void testException() throws Exception { - - final List strings = Arrays.asList("a", "b", "c"); - final IssueJIIB20 one = new IssueJIIB20(); - one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); - - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java deleted file mode 100644 index 01ba2358..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB44Test extends TestCase { - - private JAXBContext context; - - @Override - protected void setUp() throws Exception { - context = JAXBContext.newInstance(getClass().getPackage().getName()); - } - - public void testReferencesPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_0.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testReferencesPropertyAsReferencePropertyType() - throws Exception { - - IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_1.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testElementsPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_2.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getString().size()); - Assert.assertEquals(3, value.getInt().size()); - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 2ea29226..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); -// args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xsetters-mode=direct"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); - args.add("-Xannotate"); - args.add("-Xsimplify"); - return args; - } - -} diff --git a/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml deleted file mode 100644 index 0915dfad..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml deleted file mode 100644 index b811fb9b..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml deleted file mode 100644 index 0008e3ee..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - a - b - 0 - c - 1 - 2 - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.6.5/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.6.5/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/one/.classpath b/basics/tags/0.6.5/tests/one/.classpath deleted file mode 100644 index 0f040a45..00000000 --- a/basics/tags/0.6.5/tests/one/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.6.5/tests/one/.project b/basics/tags/0.6.5/tests/one/.project deleted file mode 100644 index ebe2a078..00000000 --- a/basics/tags/0.6.5/tests/one/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/tests/one/pom.xml b/basics/tags/0.6.5/tests/one/pom.xml deleted file mode 100644 index 9b0c93c0..00000000 --- a/basics/tags/0.6.5/tests/one/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xannotate - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - - - - diff --git a/basics/tags/0.6.5/tests/one/src/main/resources/binding.xjb b/basics/tags/0.6.5/tests/one/src/main/resources/binding.xjb deleted file mode 100644 index d332e4ca..00000000 --- a/basics/tags/0.6.5/tests/one/src/main/resources/binding.xjb +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.5/tests/one/src/main/resources/schema.xsd b/basics/tags/0.6.5/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index e527b565..00000000 --- a/basics/tags/0.6.5/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.6.5/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.6.5/tests/one/src/test/resources/log4j.properties b/basics/tags/0.6.5/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.5/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/one/src/test/samples/1.xml b/basics/tags/0.6.5/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.6.5/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.6.5/tests/one/src/test/samples/2.xml b/basics/tags/0.6.5/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.6.5/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.6.5/tests/pom.xml b/basics/tags/0.6.5/tests/pom.xml deleted file mode 100644 index cf3cbba9..00000000 --- a/basics/tags/0.6.5/tests/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - annotate - annox - episodes - one - issues - zj - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/tests - - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - - generate - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/wildcard/.classpath b/basics/tags/0.6.5/tests/wildcard/.classpath deleted file mode 100644 index fd1a8b60..00000000 --- a/basics/tags/0.6.5/tests/wildcard/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.6.5/tests/wildcard/.project b/basics/tags/0.6.5/tests/wildcard/.project deleted file mode 100644 index 4da28ca5..00000000 --- a/basics/tags/0.6.5/tests/wildcard/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-wildcard - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/tests/wildcard/pom.xml b/basics/tags/0.6.5/tests/wildcard/pom.xml deleted file mode 100644 index a554daa6..00000000 --- a/basics/tags/0.6.5/tests/wildcard/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-wildcard - jar - JAXB2 Basics - Test [wildcard] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xwildcard - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.5/tests/wildcard/src/main/resources/binding.xjb b/basics/tags/0.6.5/tests/wildcard/src/main/resources/binding.xjb deleted file mode 100644 index 8f780f74..00000000 --- a/basics/tags/0.6.5/tests/wildcard/src/main/resources/binding.xjb +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/basics/tags/0.6.5/tests/wildcard/src/main/resources/schema.xsd b/basics/tags/0.6.5/tests/wildcard/src/main/resources/schema.xsd deleted file mode 100644 index 7d520ce9..00000000 --- a/basics/tags/0.6.5/tests/wildcard/src/main/resources/schema.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/zj/pom.xml b/basics/tags/0.6.5/tests/zj/pom.xml deleted file mode 100644 index 9e278656..00000000 --- a/basics/tags/0.6.5/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.6.5/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.6.5/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.6.5/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.6.5/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.6.5/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.6.5/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.6.5/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.6.5/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.6.5/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.6.5/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.6.5/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.6.5/tools/.classpath b/basics/tags/0.6.5/tools/.classpath deleted file mode 100644 index 9c865fb7..00000000 --- a/basics/tags/0.6.5/tools/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.6.5/tools/.project b/basics/tags/0.6.5/tools/.project deleted file mode 100644 index e7b0094b..00000000 --- a/basics/tags/0.6.5/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.6.5/tools/pom.xml b/basics/tags/0.6.5/tools/pom.xml deleted file mode 100644 index b8db6257..00000000 --- a/basics/tags/0.6.5/tools/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.6.5 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - commons-lang - commons-lang - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index 4fea93c7..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!StringUtils.isEmpty(namespaceURI)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d4ca11b5..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 176d5a2c..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,654 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(Outline outline, QName name) { - final CPluginCustomization customization = findCustomization(outline, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(Model model, QName name) { - final CPluginCustomization customization = findCustomization(model, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(EnumOutline enumOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - enumOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - Outline outline, QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CEnumLeafInfo enumLeafInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - enumLeafInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Outline outline, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(outline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Outline outline) { - return getCustomizations(outline.getModel()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index bb81f031..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index a7e6b211..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = parent.getParent().getClassOutline( - classInfo.getBaseTypeInfo()); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 16f45c22..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 9535bcaa..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 59cda4e0..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index 2e6d3fa8..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - generateClassOutline(modelOutline, modelInfo, - classInfo.getBaseTypeInfo()); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index ee45b6b0..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index e43958e1..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 41dcc73f..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - public XJCCMInfoFactory(Model model) { - super(model); - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - private final Map packages = new HashMap(); - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 946ab670..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index f855af96..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index 7d59132d..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 4414b8ae..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 0c5e02a0..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index 7f414d27..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 70f7489d..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index d98988d0..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index b6673c80..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index b7df6bbe..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 1d3a1f57..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 517cbb27..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index ef8a2639..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index 5d7c77a2..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c632055a..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 7cd5160b..00000000 --- a/basics/tags/0.6.5/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/tags/0.6.5/update-all-versions.bat b/basics/tags/0.6.5/update-all-versions.bat deleted file mode 100644 index f8e2a12d..00000000 --- a/basics/tags/0.6.5/update-all-versions.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -call update-versions %cd% %1 %2 \ No newline at end of file diff --git a/basics/tags/0.6.5/update-version.bat b/basics/tags/0.6.5/update-version.bat deleted file mode 100644 index 8a52b653..00000000 --- a/basics/tags/0.6.5/update-version.bat +++ /dev/null @@ -1,3 +0,0 @@ -sed "s/%2/%3/g" %1 > %1.tmp -del %1 -move %1.tmp %1 \ No newline at end of file diff --git a/basics/tags/0.6.5/update-versions.bat b/basics/tags/0.6.5/update-versions.bat deleted file mode 100644 index 1499b4f4..00000000 --- a/basics/tags/0.6.5/update-versions.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -for /R %1 %%x in (pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.classpath) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (.tomcatplugin) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-pom.xml) do if exist %%x call update-version %%x %2 %3 -for /R %1 %%x in (project-build.xml) do if exist %%x call update-version %%x %2 %3 diff --git a/basics/tags/0.7.0/ant/.classpath b/basics/tags/0.7.0/ant/.classpath deleted file mode 100644 index 9c865fb7..00000000 --- a/basics/tags/0.7.0/ant/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.7.0/ant/.project b/basics/tags/0.7.0/ant/.project deleted file mode 100644 index 63b92b0b..00000000 --- a/basics/tags/0.7.0/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.7.0/ant/pom.xml b/basics/tags/0.7.0/ant/pom.xml deleted file mode 100644 index 859e55b6..00000000 --- a/basics/tags/0.7.0/ant/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.7.0 - ../pom.xml - - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.7.0/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.7.0/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.7.0/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.7.0/basic/.classpath b/basics/tags/0.7.0/basic/.classpath deleted file mode 100644 index ee6d2357..00000000 --- a/basics/tags/0.7.0/basic/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.7.0/basic/.project b/basics/tags/0.7.0/basic/.project deleted file mode 100644 index 9ef5e932..00000000 --- a/basics/tags/0.7.0/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.7.0/basic/pom.xml b/basics/tags/0.7.0/basic/pom.xml deleted file mode 100644 index c68e550b..00000000 --- a/basics/tags/0.7.0/basic/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.7.0 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.7.0 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - com.google.code.javaparser - javaparser - 1.0.8 - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.felix - - - maven-bundle-plugin - - - [2.3.7,) - - - manifest - - - - - - - - - - org.jvnet.jaxb2.maven2 - - - maven-jaxb2-plugin - - - [0.8.1,) - - - generate - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 176f243b..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(EnumOutline enumOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 0d007353..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(EnumOutline enumOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index ca56dce8..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,335 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String copyStrategyClass = JAXBCopyStrategy.class.getName(); - - public void setCopyStrategyClass(final String copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public String getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, - codeModel.ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, - codeModel.ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl( - JMod.FINAL, - theClass.owner().ref(Object.class), - "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), - JExpr.invoke("createNewInstance"), target)); - } else { - body._if(JExpr._null().eq(target)) - ._then() - ._throw(JExpr - ._new(theClass.owner().ref( - IllegalArgumentException.class)) - .arg("Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator) - .arg(draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", - JExpr.cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (!sourceFieldAccessor.isAlwaysSet() - && valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr - .invoke(copyStrategy, "copy") - .arg(theClass - .owner() - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), - copyFieldType.isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java deleted file mode 100644 index 0b550431..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/enumvalue"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java deleted file mode 100644 index 177a950c..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.EnumValue; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EnumValuePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XenumValue"; - } - - @Override - public String getUsage() { - return "Forces generated @XmlEnums implement the org.jvnet.jaxb2_commons.lang.EnumValue interface."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final EnumOutline enumOutline : outline.getEnums()) { - if (!getIgnoring().isIgnored(enumOutline)) { - processEnumOutline(enumOutline); - } - } - return true; - } - - protected void processEnumOutline(EnumOutline enumOutline) { - CEnumLeafInfo enumLeafInfo = enumOutline.target; - JClass enumType = enumLeafInfo.base.toType(enumOutline.parent(), - Aspect.EXPOSED).boxify(); - - final JDefinedClass theClass = enumOutline.clazz; - - ClassUtils._implements(theClass, theClass.owner().ref(EnumValue.class) - .narrow(enumType)); - - final JMethod enumValue$enumValue = theClass.method(JMod.PUBLIC, - enumType, "enumValue"); - enumValue$enumValue.body()._return(JExpr._this().invoke("value")); - } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 5d35be2b..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); - - public void setEqualsStrategyClass(String equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public String getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - // - // @SuppressWarnings("unused") - // final JMethod equals$equals = generateEquals$equals(enumOutline, - // theClass); - // } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } - - // protected JMethod generateEquals$equals(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // final JCodeModel codeModel = theClass.owner(); - // final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - // "equals"); - // - // { - // final JBlock body = equals.body(); - // final JVar leftLocator = equals.param(ObjectLocator.class, - // "thisLocator"); - // final JVar rightLocator = equals.param(ObjectLocator.class, - // "thatLocator"); - // final JVar object = equals.param(Object.class, "object"); - // final JVar equalsStrategy = equals.param(EqualsStrategy.class, - // "strategy"); - // - // body._return(equalsStrategy - // .invoke("equals") - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(leftLocator) - // .arg("value").arg(JExpr._this().ref("value"))) - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(rightLocator) - // .arg("value").arg(object.ref("value"))) - // .arg(JExpr._this().ref("value")).arg(object.ref("value"))); - // - // } - // return equals; - // } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index 571b6fbe..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); - - public void setHashCodeStrategyClass(String hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public String getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - // - // // @SuppressWarnings("unused") - // // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode = generateHashCode$hashCode( - // enumOutline, theClass); - // // @SuppressWarnings("unused") - // // final JMethod object$hashCode = generateObject$hashCode(enumOutline, - // // theClass); - // } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - return generateObject$hashCode(theClass); - } - - // protected JMethod generateObject$hashCode(final EnumOutline enumOutline, - // final JDefinedClass theClass) { - // return generateObject$hashCode(theClass); - // } - - private JMethod generateObject$hashCode(final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, - theClass.owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass - .owner().ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl( - fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign( - currentHashCode, - hashCodeStrategy - .invoke("hashCode") - .arg(codeModel - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(theValue)) - .arg(currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } - - // protected JMethod generateHashCode$hashCode(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // JCodeModel codeModel = theClass.owner(); - // final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - // codeModel.INT, "hashCode"); - // final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - // "locator"); - // final JVar hashCodeStrategy = hashCode$hashCode.param( - // HashCodeStrategy.class, "strategy"); - // final JBlock body = hashCode$hashCode.body(); - // - // body._return(hashCodeStrategy - // .invoke("hashCode") - // .arg(codeModel.ref(LocatorUtils.class).staticInvoke("property") - // .arg(locator).arg("value") - // .arg(JExpr._this().ref("value"))).arg(JExpr.lit(1)) - // .arg(JExpr._this().ref("value"))); - // - // return hashCode$hashCode; - // } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index 0d8c96ec..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIEnum; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - final Map knownClasses = new HashMap(); - final Map knownClassInfos = new IdentityHashMap(); - - for (final ClassOutline classOutline : outline.getClasses()) { - knownClasses.put(classOutline.implClass.fullName(), - classOutline.implClass); - knownClassInfos.put(classOutline.implClass, classOutline.target); - } - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, knownClasses, knownClassInfos); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, knownClasses); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, knownClasses); - } - } - processPackageOutlines(outline, knownClasses); - return true; - } - - private void processClassOutline(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - - generateExtends(classOutline, knownClasses, knownClassInfos); - generateImplements(classOutline, knownClasses); - - } - - private void processEnumOutline(EnumOutline enumOutline, - Map knownClasses) { - - generateExtends(enumOutline, knownClasses); - generateImplements(enumOutline, knownClasses); - - } - - private void processElementOutline(ElementOutline elementOutline, - Map knownClasses) { - - generateExtends(elementOutline, knownClasses); - generateImplements(elementOutline, knownClasses); - - } - - private void processPackageOutlines(Outline outline, - Map knownClasses) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass, - knownClasses); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface, knownClasses); - } - } - } - } - } - } - } - } - - private JClass generateExtends(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - JClass targetClass = generateExtends(theClass, - extendsClassCustomization, knownClasses); - - final CClassInfo classInfo = classOutline.target; - if (targetClass != null && classInfo.getBaseClass() == null - && classInfo.getRefBaseClass() == null) { - final CClassInfo targetClassInfo = knownClassInfos.get(targetClass); - if (targetClassInfo == null && classInfo.getRefBaseClass() == null) { - final Model model = classInfo.model; - // BIEnum as BIClass is protected too much - final BIEnum decl = new BIEnum(); - decl.ref = targetClass.fullName(); - final CClassRef baseClass = new CClassRef(model, - classInfo.getSchemaComponent(), decl, - new CCustomizations()); - classInfo.setBaseClass(baseClass); - } else if (targetClassInfo != null - && classInfo.getBaseClass() == null) { - classInfo.setBaseClass(targetClassInfo); - } - } - return targetClass; - } - - private JClass generateExtends(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization, - Map knownClasses) throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - return generateExtends(theClass, extendsClass, knownClasses); - } else { - return null; - } - } - - private JClass generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass, Map knownClasses) { - if (extendsClass.getClassName() != null) { - final String _class = extendsClass.getClassName(); - final JClass targetClass = parseClass(_class, theClass.owner(), - knownClasses); - theClass._extends(targetClass); - return targetClass; - } else { - return null; - } - } - - private List generateImplements(ClassOutline classOutline, - Map knownClasses) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations, - Map knownClasses) throws AssertionError { - final List implementedInterfaces = new ArrayList( - implementsInterfaceCustomizations.size()); - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - - final JClass implementedInterface = generateImplements( - theClass, implementsInterface, knownClasses); - if (implementedInterface != null) { - implementedInterfaces.add(implementedInterface); - } - } - } - return implementedInterfaces; - } - - private JClass generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface, - Map knownClasses) { - - String _interface = implementsInterface.getInterfaceName(); - if (_interface != null) { - final JClass targetClass = parseClass(_interface, theClass.owner(), - knownClasses); - theClass._implements(targetClass); - return targetClass; - } else { - return null; - } - } - - private JClass parseClass(String _class, JCodeModel codeModel, - Map knownClasses) { - return new JavaTypeParser(knownClasses).parseClass(_class, codeModel); - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java deleted file mode 100644 index 5fa73bc2..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.JavaParser; -import japa.parser.ParseException; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class JavaTypeParser { - - static { - JavaParser.setCacheParser(false); - } - - private final TypeToJTypeConvertingVisitor typeToJTypeConvertingVisitor; - - public JavaTypeParser() { - this(Collections. emptyMap()); - } - - public JavaTypeParser(Map knownClasses) { - Validate.notNull(knownClasses); - this.typeToJTypeConvertingVisitor = new TypeToJTypeConvertingVisitor( - knownClasses); - - } - - public JClass parseClass(String _class, JCodeModel codeModel) { - JType type = parseType(_class, codeModel); - if (type instanceof JClass) { - return (JClass) type; - } else { - throw new IllegalArgumentException("Type [" + _class - + "] is not a class."); - } - } - - private JType parseType(String type, JCodeModel codeModel) { - final String text = "public class Ignored extends " + type + " {}"; - try { - CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - final List _extended = classDeclaration - .getExtends(); - final ClassOrInterfaceType classOrInterfaceType = _extended.get(0); - - return classOrInterfaceType.accept( - this.typeToJTypeConvertingVisitor, codeModel); - } catch (ParseException pex) { - throw new IllegalArgumentException( - "Could not parse the type definition [" + type + "].", pex); - } catch (UnsupportedEncodingException uex) { - throw new UnsupportedOperationException(uex); - } - } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java deleted file mode 100644 index 021d97b3..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; -import japa.parser.ast.visitor.GenericVisitorAdapter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class TypeToJTypeConvertingVisitor extends - GenericVisitorAdapter { - - private final Map knownClasses; - - public TypeToJTypeConvertingVisitor(Map knownClasses) { - Validate.notNull(knownClasses); - this.knownClasses = knownClasses; - } - - @Override - public JType visit(VoidType type, JCodeModel codeModel) { - return codeModel.VOID; - } - - @Override - public JType visit(PrimitiveType type, JCodeModel codeModel) { - switch (type.getType()) { - case Boolean: - return codeModel.BOOLEAN; - case Char: - return codeModel.CHAR; - case Byte: - return codeModel.BYTE; - case Short: - return codeModel.SHORT; - case Int: - return codeModel.INT; - case Long: - return codeModel.LONG; - case Float: - return codeModel.FLOAT; - case Double: - return codeModel.DOUBLE; - default: - throw new AssertionError("Unknown primitive type [" - + type.getType() + "]"); - } - } - - @Override - public JType visit(ReferenceType type, JCodeModel codeModel) { - final JType referencedType = type.getType().accept(this, codeModel); - - JType referencedTypeArray = referencedType; - for (int index = 0; index < type.getArrayCount(); index++) { - referencedTypeArray = referencedTypeArray.array(); - } - return referencedTypeArray; - } - - @Override - public JType visit(WildcardType type, JCodeModel codeModel) { - - if (type.getExtends() != null) { - final ReferenceType _extends = type.getExtends(); - final JType boundType = _extends.accept(this, codeModel); - - if (!(boundType instanceof JClass)) { - throw new IllegalArgumentException("Bound type [" + _extends - + "]in the wildcard type must be class."); - } - - final JClass boundClass = (JClass) boundType; - return boundClass.wildcard(); - } else if (type.getSuper() != null) { - // TODO - throw new IllegalArgumentException( - "Wildcard types with super clause are not supported at the moment."); - } else { - throw new IllegalArgumentException( - "Wildcard type must have either extends or super clause."); - } - } - - @Override - public JType visit(ClassOrInterfaceType type, JCodeModel codeModel) { - final String name = getName(type); - final JClass knownClass = this.knownClasses.get(name); - final JClass jclass = knownClass != null ? knownClass : codeModel - .ref(name); - final List typeArgs = type.getTypeArgs(); - if (typeArgs == null || typeArgs.isEmpty()) { - return jclass; - } else { - final List jtypeArgs = new ArrayList( - typeArgs.size()); - for (Type typeArg : typeArgs) { - final JType jtype = typeArg.accept(this, codeModel); - if (!(jtype instanceof JClass)) { - throw new IllegalArgumentException("Type argument [" - + typeArg.toString() + "] is not a class."); - } else { - jtypeArgs.add((JClass) jtype); - } - } - return jclass.narrow(jtypeArgs); - } - } - - private String getName(ClassOrInterfaceType type) { - final String name = type.getName(); - final ClassOrInterfaceType scope = type.getScope(); - if (scope == null) { - return name; - } else { - return getName(scope) + "." + name; - } - } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index c83e1901..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); - - public void setMergeStrategyClass( - final String mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public String getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index fbc662d6..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - public static enum Mode { - - accessor { - - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(setter.body()); - accessor.fromRawValue(setter.body(), "draft", value); - } - }, - direct { - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - - final JFieldVar field = theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - - if (field != null) { - setter.body().assign(JExpr._this().ref(field), value); - } else { - // Fallback to the accessor - Mode.accessor.generateSetter(fieldOutline, theClass, - setter, value); - } - } - }; - public abstract void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value); - } - - private Mode mode = Mode.accessor; - - public String getMode() { - return mode.name(); - - } - - public void setMode(String mode) { - Validate.notNull(mode); - try { - this.mode = Mode.valueOf(mode); - } catch (IllegalArgumentException iaex) { - throw new IllegalArgumentException( - "Unsupported mode [" - + mode - + "]." - + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" - + " and [direct] (assigns the value to the field directly)."); - } - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - - mode.generateSetter(fieldOutline, theClass, - generatedSetter, value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java deleted file mode 100644 index 783cf37b..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - - public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-element-property"); - - public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-reference-property"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java deleted file mode 100644 index 97de9dd7..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeRef; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.ID; - -public class SimplifyPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xsimplify"; - } - - @Override - public String getUsage() { - return "This plugin allows simplifying \"complex\" properties" - + " (ex. aOrBOrC generated from repeatable choices)" - + " into several \"simple\" properties (ex. a, b, c).\n" - + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" - + " for plugin documentation."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public void postProcessModel(final Model model, ErrorHandler errorHandler) { - - for (final CClassInfo classInfo : model.beans().values()) { - postProcessClassInfo(model, classInfo); - } - } - - private void postProcessClassInfo(final Model model, - final CClassInfo classInfo) { - final List properties = new ArrayList( - classInfo.getProperties()); - for (CPropertyInfo property : properties) { - property.accept(new CPropertyVisitor() { - - public Void onElement(CElementPropertyInfo elementProperty) { - postProcessElementPropertyInfo(model, classInfo, - elementProperty); - return null; - } - - public Void onAttribute(CAttributePropertyInfo attributeProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onValue(CValuePropertyInfo valueProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onReference(CReferencePropertyInfo p) { - postProcessReferencePropertyInfo(model, classInfo, p); - return null; - } - - }); - } - } - - private void postProcessElementPropertyInfo(final Model model, - final CClassInfo classInfo, CElementPropertyInfo property) { - if (property.isCollection() && property.getTypes().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyElementPropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } - } - } - - private void postProcessReferencePropertyInfo(final Model model, - final CClassInfo classInfo, CReferencePropertyInfo property) { - if (property.isCollection() && property.getElements().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } else if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsReferencePropertyInfo(model, - classInfo, property); - } - } - } - - private void simplifyElementPropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CElementPropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CTypeRef typeRef : property.getTypes()) { - final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( - model, property, typeRef); - classInfo.getProperties().add(index++, elementPropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsReferencePropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( - model, property, element); - classInfo.getProperties().add(index++, referencePropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CElementPropertyInfo elementPropertyInfo; - if (element instanceof CElementInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CElementInfo) element); - } else if (element instanceof CClassInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CClassInfo) element); - - } else if (element instanceof CClassRef) { - // elementPropertyInfo = createElementPropertyInfo(model, - // element, - // (CClassRef) element); - elementPropertyInfo = null; - // TODO WARN - - } else { - // TODO WARN - elementPropertyInfo = null; - } - if (elementPropertyInfo != null) { - classInfo.getProperties().add(index++, elementPropertyInfo); - } - } - classInfo.getProperties().remove(property); - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CElementInfo elementInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(elementInfo.getContentType(), element - .getElementName(), elementInfo.getContentType() - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CClassInfo classInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(classInfo, element.getElementName(), classInfo - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - // private CElementPropertyInfo createElementPropertyInfo(final Model model, - // CElement element, final CClassRef cr) { - // final CElementPropertyInfo elementPropertyInfo; - // final String propertyName = createPropertyName(model, element); - // elementPropertyInfo = new CElementPropertyInfo(propertyName, - // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - // element.getSchemaComponent(), element.getCustomizations(), - // element.getLocator(), false); - // elementPropertyInfo.getTypes().add( - // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), - // false, null)); - // return elementPropertyInfo; - // } - - private CReferencePropertyInfo createReferencePropertyInfo( - final Model model, CReferencePropertyInfo property, CElement element) { - final String propertyName = createPropertyName(model, element); - final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( - propertyName, true, false, property.isMixed(), - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), property.isDummy(), property.isContent(), - property.isMixedExtendedCust()); - referencePropertyInfo.getElements().add(element); - return referencePropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElementPropertyInfo property, CTypeRef typeRef) { - final String propertyName = createPropertyName(model, typeRef); - boolean required = false; - final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( - propertyName, CollectionMode.REPEATED_ELEMENT, typeRef - .getTarget().idUse(), typeRef.getTarget() - .getExpectedMimeType(), property.getSchemaComponent(), - property.getCustomizations(), property.getLocator(), required); - elementPropertyInfo.getTypes().add(typeRef); - return elementPropertyInfo; - } - - private String createPropertyName(final Model model, CElement element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getElementName().getLocalPart()); - return propertyName; - } - - private String createPropertyName(final Model model, CTypeRef element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getTagName().getLocalPart()); - return propertyName; - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index dc8eac3c..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); - - public void setToStringStrategyClass( - String toStringStrategy) { - this.toStringStrategyClass = toStringStrategy; - } - - public String getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 6f95d0b1..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final String strategyClassName) { - - try { - final Class strategyClass = Class.forName(strategyClassName); - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } catch (ClassNotFoundException cnfex) { - final JClass strategyJClass = codeModel.ref(strategyClassName); - return JExpr._new(strategyJClass); - } - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index b44a1cb3..00000000 --- a/basics/tags/0.7.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - final boolean laxModel = CustomizationUtils.containsCustomization( - model, Customizations.LAX_ELEMENT_NAME); - final boolean skipModel = CustomizationUtils.containsCustomization( - model, Customizations.SKIP_ELEMENT_NAME); - final boolean strictModel = CustomizationUtils.containsCustomization( - model, Customizations.STRICT_ELEMENT_NAME); - for (CClassInfo classInfo : model.beans().values()) { - final boolean laxClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.STRICT_ELEMENT_NAME); - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - final boolean laxPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME); - - if (laxModel) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipModel) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictModel) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.7.0/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.7.0/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 99ef7147..00000000 --- a/basics/tags/0.7.0/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,13 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin -org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin -org.jvnet.jaxb2_commons.plugin.enumvalue.EnumValuePlugin \ No newline at end of file diff --git a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java b/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java deleted file mode 100644 index 30bdf587..00000000 --- a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; - -public class JavaParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final JavaTypeParser javaTypeParser = new JavaTypeParser(); - final JCodeModel codeModel = new JCodeModel(); - JClass comparator = javaTypeParser.parseClass("java.util.Comparator", - codeModel); - assertNotNull(comparator); - JClass integerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(integerComparator); - JClass wildcardIntegerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(wildcardIntegerComparator); - } -} diff --git a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java b/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java deleted file mode 100644 index a2562048..00000000 --- a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; - -import java.io.ByteArrayInputStream; -import java.util.List; - -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - assertEquals(1, typeDeclarations.size()); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - assertEquals("Dummy", classDeclaration.getName()); - final List implementedInterfaces = classDeclaration - .getImplements(); - assertEquals(1, implementedInterfaces.size()); - final ClassOrInterfaceType implementedInterface = implementedInterfaces - .get(0); - assertEquals("Comparator", implementedInterface.getName()); - final List typeArgs = implementedInterface.getTypeArgs(); - assertEquals(1, typeArgs.size()); - final Type typeArg = typeArgs.get(0); - assertTrue(typeArg instanceof ReferenceType); - final ReferenceType referenceTypeArg = (ReferenceType) typeArg; - final Type referencedType = referenceTypeArg.getType(); - assertTrue(referencedType instanceof ClassOrInterfaceType); - final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; - assertEquals("Integer", typeArgType.getName()); - - } -} diff --git a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.7.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.7.0/basic/src/test/resources/schema.xsd b/basics/tags/0.7.0/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.7.0/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/build-1.5.bat b/basics/tags/0.7.0/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.7.0/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.7.0/build-1.6.bat b/basics/tags/0.7.0/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.7.0/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.7.0/deploy.bat b/basics/tags/0.7.0/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/tags/0.7.0/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/tags/0.7.0/dist/pom.xml b/basics/tags/0.7.0/dist/pom.xml deleted file mode 100644 index 970cd553..00000000 --- a/basics/tags/0.7.0/dist/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.7.0 - ../pom.xml - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/dist - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - diff --git a/basics/tags/0.7.0/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.7.0/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.7.0/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.7.0/dist/src/main/assembly/dist.xml b/basics/tags/0.7.0/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.7.0/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.7.0/install-1.5.bat b/basics/tags/0.7.0/install-1.5.bat deleted file mode 100644 index 24bfffb2..00000000 --- a/basics/tags/0.7.0/install-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn -X -DperformRelease -P samples,tests clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.7.0/install-1.6.bat b/basics/tags/0.7.0/install-1.6.bat deleted file mode 100644 index 57a75b67..00000000 --- a/basics/tags/0.7.0/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -Psamples,tests,dist clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.7.0/install.bat b/basics/tags/0.7.0/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/tags/0.7.0/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/tags/0.7.0/jaxb/pom.xml b/basics/tags/0.7.0/jaxb/pom.xml deleted file mode 100644 index 2ad49ae7..00000000 --- a/basics/tags/0.7.0/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 7 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/jaxb/release.bat b/basics/tags/0.7.0/jaxb/release.bat deleted file mode 100644 index e6784200..00000000 --- a/basics/tags/0.7.0/jaxb/release.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn clean deploy -DperformRelease=true -Psonatype-oss-release \ No newline at end of file diff --git a/basics/tags/0.7.0/jaxb/xjc/pom.xml b/basics/tags/0.7.0/jaxb/xjc/pom.xml deleted file mode 100644 index a2a60692..00000000 --- a/basics/tags/0.7.0/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.4 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/pom.xml b/basics/tags/0.7.0/pom.xml deleted file mode 100644 index e9825763..00000000 --- a/basics/tags/0.7.0/pom.xml +++ /dev/null @@ -1,334 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.7.0 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/trunk - - - ant - runtime - tools - testing - basic - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - dist - - - dist - - - - dist - - - - - 2.2.5-2 - 0.8.2 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb.version} - - - - junit - junit - 3.8.1 - - - - org.apache.commons - commons-lang3 - 3.2.1 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.7.0/release.bat b/basics/tags/0.7.0/release.bat deleted file mode 100644 index c1d14b91..00000000 --- a/basics/tags/0.7.0/release.bat +++ /dev/null @@ -1,76 +0,0 @@ -setlocal -echo Setting JAVA_HOME to %JAVA6_HOME%. -set JAVA_HOME=%JAVA6_HOME% - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -DperformRelease -Psamples,tests,dist -echo Full clean build completed. -pause - -echo Setting new version to %1. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 -echo Version was set to %1. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %1 committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -Psamples,tests,dist -DperformRelease -echo Full clean build completed. -pause - -echo Checking in version %1. -pause -mvn scm:checkin -Dmessage="Version %1" -echo Version %1 was checked in. -pause - -echo Tagging version %1. -pause -mvn scm:tag -Dtag=%1 -echo Version %1 was tagged. -pause - -echo Performing full clean deploy. -pause -call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy -echo Full clean deploy done. -pause - -echo Setting new version to %2. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 -echo Version was set to %2. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %2 was committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -pause - -echo Checking in version %2. -pause -mvn scm:checkin -Dmessage="Version %2" -echo Version %2 was checked in. -pause - -endlocal \ No newline at end of file diff --git a/basics/tags/0.7.0/runtime/.classpath b/basics/tags/0.7.0/runtime/.classpath deleted file mode 100644 index ee6d2357..00000000 --- a/basics/tags/0.7.0/runtime/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.7.0/runtime/.project b/basics/tags/0.7.0/runtime/.project deleted file mode 100644 index 5bfa86f3..00000000 --- a/basics/tags/0.7.0/runtime/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.7.0/runtime/pom.xml b/basics/tags/0.7.0/runtime/pom.xml deleted file mode 100644 index 4639a589..00000000 --- a/basics/tags/0.7.0/runtime/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - 0.7.0 - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.7.0 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - - - bundle-manifest - process-classes - - manifest - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index d66a74b7..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,371 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else if (lhs instanceof Equals[]) { - return equalsInternal(leftLocator, rightLocator, (Equals[]) lhs, - (Equals[]) rhs); - } else if (lhs instanceof Enum[]) { - return equalsInternal(leftLocator, rightLocator, (Enum[]) lhs, - (Enum[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else if (lhs instanceof Enum) { - return equalsInternal(leftLocator, rightLocator, (Enum) lhs, (Enum) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum lhs, Enum rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals lhs, Equals rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - return lhs.equals(leftLocator, rightLocator, rhs, this); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals[] left, Equals[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum[] left, Enum[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index e54659cd..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else if (object instanceof HashCode[]) { - return hashCodeInternal(locator, hashCode, (HashCode[]) object); - } else if (object instanceof Enum[]) { - return hashCodeInternal(locator, hashCode, (Enum[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else if (value instanceof Enum) { - return hashCodeInternal(locator, hashCode, (Enum) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode object) { - if (object == null) { - return hashCode * iConstant; - } else { - return hashCode * iConstant + object.hashCode(locator, this); - } - } - - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java deleted file mode 100644 index 9e843b88..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public interface EnumValue { - - public T enumValue(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index a6c06704..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 88b3cce7..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - // Treat empty lists as nulls - if (list.isEmpty()) { - return super.hashCode(locator, hashCode, (Object) null); - } else { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 8407ab35..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - public String getPathAsString() { - final String stepAsString = getStepAsString(); - final ObjectLocator parentLocator = getParentLocator(); - return parentLocator == null ? stepAsString : parentLocator - .getPathAsString() + stepAsString; - } - - protected abstract String getStepAsString(); - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - - // public Object[] getMessageParameters() { - // return new Object[] { getObject() }; - // } - // - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() + ".messages")); - } - - // public int hashCode() { - // int hashCode = getObject().hashCode(); - // return hashCode; - // } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index ce0d32ff..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "[" + getIndex() + "]"; - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index 0484223a..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "." + getPropertyName(); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index ecd6fc3e..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return ""; - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 37aa8555..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * @return Path to this locator in string form; - */ - public String getPathAsString(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index 304c05a1..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MPackagedTypeInfo, - MOriginated, MContainer { - - public C getTargetClass(); - - public MClassInfo getBaseTypeInfo(); - - public String getName(); - - public String getLocalName(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java deleted file mode 100644 index 73f92248..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContained { - - public MContainer getContainer(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java deleted file mode 100644 index e55cac10..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContainer extends MPackaged { - - public String getLocalName(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java deleted file mode 100644 index 1a673485..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomizable { - - public MCustomizations getCustomizations(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java deleted file mode 100644 index 3e32cc52..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomization { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java deleted file mode 100644 index b20537dc..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MCustomizations { - - public List getCustomizations(); - - public void addCustomization(MCustomization customization); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index 6c72d310..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated, MContained, MContainer { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java deleted file mode 100644 index 4a43b435..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MID extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java deleted file mode 100644 index 49ca1c30..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREF extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java deleted file mode 100644 index 1f0b2084..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREFS extends MList { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 9e0b5b8c..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MCustomizable, - MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 6ea7fe61..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated, - MContainer { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 7c7571b9..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged, - MContained { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index 0d628be5..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitID(MID info) { - return null; - } - - public V visitIDREF(MIDREF info) { - return null; - } - - public V visitIDREFS(MIDREFS info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 98a86bc7..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo extends MCustomizable { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 91e31247..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor { - - public V visitList(MList info); - - public V visitID(MID info); - - public V visitIDREF(MIDREF info); - - public V visitIDREFS(MIDREFS info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - - public V visitClassInfo(MClassInfo info); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 6dd77b37..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - private final MCustomizations customizations = new CMCustomizations(); - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index b3db5039..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - private final MClassInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MClassInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getContainer(), getLocalName(), - getElementName(), scope, this, substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MContainer getScope() { - return container; - } - - public MClassInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java deleted file mode 100644 index 6e09ab64..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.w3c.dom.Element; - -public class CMCustomization implements MCustomization { - - private final Element element; - - public CMCustomization(Element element) { - this.element = element; - } - - public Element getElement() { - return element; - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java deleted file mode 100644 index c7bfa857..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; - -public class CMCustomizations implements MCustomizations { - - private final List customizations = new LinkedList(); - private final List unmodifiableCustomizations = Collections - .unmodifiableList(this.customizations); - - public List getCustomizations() { - return unmodifiableCustomizations; - } - - public void addCustomization(MCustomization customization) { - Validate.notNull(customization); - this.customizations.add(customization); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index e539fd75..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final MContainer container; - - private final String localName; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - MContainer container, String localName, QName elementName, - MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.container = container; - this.localName = localName; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getLocalName() { - return localName; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index d25eb09e..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 47a598a2..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo, - MCustomizable { - - private final MEnumLeafInfoOrigin origin; - private final CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final MContainer container; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.container = container; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), - getContainer(), - getLocalName(), - getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java deleted file mode 100644 index 5daa634c..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMID implements MID { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMID(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitID(this); - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java deleted file mode 100644 index 2eaeacde..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMIDREF implements MIDREF { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMIDREF(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREF(this); - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java deleted file mode 100644 index accf9d52..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMIDREFS extends CMList implements MIDREFS { - - public CMIDREFS(T targetType, MTypeInfo itemTypeInfo) { - super(targetType, itemTypeInfo); - } - - @Override - public String toString() { - return MessageFormat.format("IDREFS [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREFS(this); - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index 514fa674..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,514 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - - if (list) { - switch (id) { - case ID: - final MTypeInfo tid = new CMID(ti.getTargetType(), - ti); - return new CMList(createListType(tid.getTargetType()), - tid); - case IDREF: - return new CMIDREFS(createListType(ti.getTargetType()), - ti); - default: - return new CMList(createListType(ti.getTargetType()), ti); - } - } else { - switch (id) { - case ID: - return new CMID(ti.getTargetType(), ti); - case IDREF: - return new CMIDREF(ti.getTargetType(), ti); - default: - return ti; - } - } - - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - protected MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), getLocalName(info), - info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()), - info.isElement() ? info.getElementName() : null); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MClassInfo getScope(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract String getLocalName(EI info); - - protected abstract MPackageInfo getPackage(EI info); - - protected abstract MContainer getContainer(CI info); - - protected abstract MContainer getContainer(EI info); - - protected abstract MContainer getContainer(ELI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), getTypeInfo(baseType), - info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - getContainer(element), getLocalName(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 1e50748c..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index e3ee1ebd..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final CMCustomizations customizations = new CMCustomizations(); - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 85cc5a38..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - - public String getLocalName() { - return null; - } - - public String getContainerLocalName(String delimiter) { - return null; - } - - public MPackageInfo getPackageInfo() { - return this; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index 196a11bd..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo, - MCustomizable { - - private CMCustomizations customizations = new CMCustomizations(); - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index 5f9236b9..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - private final MCustomizations customizations = new CMCustomizations(); - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index 9c163223..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitID(MID info) { - return visitTypeInfo(info); - } - - public V visitIDREF(MIDREF info) { - return visitTypeInfo(info); - } - - public V visitIDREFS(MIDREFS info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java deleted file mode 100644 index 43c96d12..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -public class PackageInfoQNameAnalyzer { - - private final MModelInfo modelInfo; - - public PackageInfoQNameAnalyzer(MModelInfo modelInfo) { - Validate.notNull(modelInfo); - this.modelInfo = modelInfo; - } - - public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - counter.add(name.getNamespaceURI()); - } - - public void attribute(QName name) { - - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - } - - public void attribute(QName name) { - counter.add(name.getNamespaceURI()); - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - private void collectNamespaceURIs(MPackageInfo packageInfo, - final QNameCollector collector) { - for (MElementInfo elementInfo : modelInfo.getElementInfos()) { - if (elementInfo.getPackageInfo() == packageInfo) { - collector.element(elementInfo.getElementName()); - } - } - - final QNameCollectingPropertyInfoVisitor visitor = new QNameCollectingPropertyInfoVisitor( - collector); - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - if (classInfo.getPackageInfo() == packageInfo) { - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - propertyInfo.acceptPropertyInfoVisitor(visitor); - } - } - } - } - - private static class NamespaceURICounter { - private Map map = new HashMap(); - - public void add(String namespaceURI) { - final Integer count = map.get(namespaceURI); - if (count == null) { - map.put(namespaceURI, Integer.valueOf(1)); - } else { - map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); - } - } - - public String getMostUsedNamespaceURI() { - String namespaceURI = null; - int count = 0; - - for (Map.Entry e : map.entrySet()) { - final String currentNamespaceURI = e.getKey(); - final int currentCount = e.getValue(); - if (namespaceURI == null) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } else { - if (currentCount > count - || (currentCount == count && namespaceURI == null)) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } - } - } - - return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; - - } - - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java deleted file mode 100644 index 6729008e..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class QNameCollectingPropertyInfoVisitor implements - MPropertyInfoVisitor { - - private final QNameCollector collector; - - public QNameCollectingPropertyInfoVisitor(QNameCollector collector) { - Validate.notNull(collector); - this.collector = collector; - } - - public Void visitElementPropertyInfo(MElementPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementsPropertyInfo(MElementsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } - - public Void visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return null; - } - - public Void visitAttributePropertyInfo(MAttributePropertyInfo info) { - collector.attribute(info.getAttributeName()); - return null; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - return null; - } - - public Void visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java deleted file mode 100644 index 2bd50907..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -public interface QNameCollector { - - public void element(QName name); - - public void attribute(QName name); -} diff --git a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.7.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.7.0/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.7.0/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.7.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.7.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.7.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.7.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.7.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.7.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.7.0/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.7.0/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.7.0/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/basic/pom.xml b/basics/tags/0.7.0/samples/basic/pom.xml deleted file mode 100644 index 08a09c10..00000000 --- a/basics/tags/0.7.0/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.7.0 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/basic/project-pom.xml b/basics/tags/0.7.0/samples/basic/project-pom.xml deleted file mode 100644 index 2909b2d1..00000000 --- a/basics/tags/0.7.0/samples/basic/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/basic/src/main/assembly/src.xml b/basics/tags/0.7.0/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.7.0/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.7.0/samples/basic/src/main/java/.placeholder b/basics/tags/0.7.0/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.7.0/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.7.0/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.7.0/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.7.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.7.0/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.7.0/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.7.0/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/basic/src/test/samples/1.xml b/basics/tags/0.7.0/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.7.0/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.7.0/samples/modular-ant/pom.xml b/basics/tags/0.7.0/samples/modular-ant/pom.xml deleted file mode 100644 index 6cc2d576..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4-SNAPSHOT - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/modular-ant/project-build.xml b/basics/tags/0.7.0/samples/modular-ant/project-build.xml deleted file mode 100644 index a2fc3e3a..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.7.0/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.7.0/samples/modular-ant/src/main/java/.placeholder b/basics/tags/0.7.0/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.7.0/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.7.0/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.7.0/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.7.0/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.7.0/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.7.0/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.7.0/samples/po/pom.xml b/basics/tags/0.7.0/samples/po/pom.xml deleted file mode 100644 index 3bcb49c8..00000000 --- a/basics/tags/0.7.0/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.7.0 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/po/project-pom.xml b/basics/tags/0.7.0/samples/po/project-pom.xml deleted file mode 100644 index edf3ced9..00000000 --- a/basics/tags/0.7.0/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/po/src/main/java/.placeholder b/basics/tags/0.7.0/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.7.0/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.7.0/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.7.0/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.7.0/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.7.0/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.7.0/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.7.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.7.0/samples/po/src/test/resources/log4j.properties b/basics/tags/0.7.0/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.7.0/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/po/src/test/samples/po.xml b/basics/tags/0.7.0/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.7.0/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/pom.xml b/basics/tags/0.7.0/samples/pom.xml deleted file mode 100644 index 939c1d6b..00000000 --- a/basics/tags/0.7.0/samples/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.7.0 - ../pom.xml - - - po - basic - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/samples/src/main/assembly/ant-src.xml b/basics/tags/0.7.0/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.7.0/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.7.0/samples/src/main/assembly/maven-src.xml b/basics/tags/0.7.0/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.7.0/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.7.0/testing/.classpath b/basics/tags/0.7.0/testing/.classpath deleted file mode 100644 index a8aec977..00000000 --- a/basics/tags/0.7.0/testing/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.7.0/testing/.project b/basics/tags/0.7.0/testing/.project deleted file mode 100644 index 4ead1953..00000000 --- a/basics/tags/0.7.0/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.7.0/testing/pom.xml b/basics/tags/0.7.0/testing/pom.xml deleted file mode 100644 index cde3de82..00000000 --- a/basics/tags/0.7.0/testing/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.7.0 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.7.0/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.7.0/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.7.0/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.7.0/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.7.0/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.7.0/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.7.0/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.7.0/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.7.0/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.7.0/testing/src/test/samples/1.xml b/basics/tags/0.7.0/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/tags/0.7.0/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.7.0/testing/src/test/samples/2.xml b/basics/tags/0.7.0/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/tags/0.7.0/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/build-1.5.bat b/basics/tags/0.7.0/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.7.0/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/build-1.6.bat b/basics/tags/0.7.0/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.7.0/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/episodes/a/pom.xml b/basics/tags/0.7.0/tests/episodes/a/pom.xml deleted file mode 100644 index fcb68c0d..00000000 --- a/basics/tags/0.7.0/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.7.0 - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.7.0/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.7.0/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.7.0/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.7.0/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.7.0/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.7.0/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.7.0/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/episodes/b/pom.xml b/basics/tags/0.7.0/tests/episodes/b/pom.xml deleted file mode 100644 index 1c5a9d2c..00000000 --- a/basics/tags/0.7.0/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.7.0 - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.7.0/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.7.0/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.7.0/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.7.0/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.7.0/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.7.0/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.7.0/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.7.0/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.7.0/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/episodes/pom.xml b/basics/tags/0.7.0/tests/episodes/pom.xml deleted file mode 100644 index eab02631..00000000 --- a/basics/tags/0.7.0/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.0 - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/ignoring/pom.xml b/basics/tags/0.7.0/tests/ignoring/pom.xml deleted file mode 100644 index 8a0cb404..00000000 --- a/basics/tags/0.7.0/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.7.0/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.7.0/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.7.0/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/issues/.classpath b/basics/tags/0.7.0/tests/issues/.classpath deleted file mode 100644 index fd1a8b60..00000000 --- a/basics/tags/0.7.0/tests/issues/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.7.0/tests/issues/.project b/basics/tags/0.7.0/tests/issues/.project deleted file mode 100644 index 444d922b..00000000 --- a/basics/tags/0.7.0/tests/issues/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.7.0/tests/issues/pom.xml b/basics/tags/0.7.0/tests/issues/pom.xml deleted file mode 100644 index d68608c5..00000000 --- a/basics/tags/0.7.0/tests/issues/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.0 - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -Xequals-equalsStrategyClass=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB42EqualsStrategy - -XhashCode - -Xcopyable - -Xmergeable - -Xmergeable-mergeStrategyClass=org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy - -Xinheritance - -Xsetters - -Xsetters-mode=direct - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - -Xsimplify - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java deleted file mode 100644 index 77921c47..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { - - @Override - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { - // Quasi custom equals - return super.equals(leftLocator, rightLocator, lhs, rhs); - } else { - return super.equals(leftLocator, rightLocator, lhs, rhs); - } - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java b/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java deleted file mode 100644 index ff1fb59f..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB48Interface { - - public T getValue(); - -} diff --git a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java b/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java deleted file mode 100644 index 25d45a45..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB53ABaseClass { - -} diff --git a/basics/tags/0.7.0/tests/issues/src/main/resources/binding.xjb b/basics/tags/0.7.0/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 947ed1a4..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,18 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - diff --git a/basics/tags/0.7.0/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.7.0/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 64b983aa..00000000 --- a/basics/tags/0.7.0/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB48Interface<java.lang.String> - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53ABaseClass - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53AType - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java deleted file mode 100644 index 746bc3b7..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB20Test extends TestCase { - - public void testException() throws Exception { - - final List strings = Arrays.asList("a", "b", "c"); - final IssueJIIB20 one = new IssueJIIB20(); - one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); - - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java deleted file mode 100644 index 01ba2358..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB44Test extends TestCase { - - private JAXBContext context; - - @Override - protected void setUp() throws Exception { - context = JAXBContext.newInstance(getClass().getPackage().getName()); - } - - public void testReferencesPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_0.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testReferencesPropertyAsReferencePropertyType() - throws Exception { - - IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_1.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testElementsPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_2.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getString().size()); - Assert.assertEquals(3, value.getInt().size()); - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 2ea29226..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); -// args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xsetters-mode=direct"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); - args.add("-Xannotate"); - args.add("-Xsimplify"); - return args; - } - -} diff --git a/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml deleted file mode 100644 index 0915dfad..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml deleted file mode 100644 index b811fb9b..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml deleted file mode 100644 index 0008e3ee..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - a - b - 0 - c - 1 - 2 - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.7.0/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.7.0/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/one/.classpath b/basics/tags/0.7.0/tests/one/.classpath deleted file mode 100644 index 0f040a45..00000000 --- a/basics/tags/0.7.0/tests/one/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basics/tags/0.7.0/tests/one/.project b/basics/tags/0.7.0/tests/one/.project deleted file mode 100644 index ebe2a078..00000000 --- a/basics/tags/0.7.0/tests/one/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.7.0/tests/one/pom.xml b/basics/tags/0.7.0/tests/one/pom.xml deleted file mode 100644 index fe7fcb79..00000000 --- a/basics/tags/0.7.0/tests/one/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.0 - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.7.0/tests/one/src/main/resources/binding.xjb b/basics/tags/0.7.0/tests/one/src/main/resources/binding.xjb deleted file mode 100644 index 3888abb4..00000000 --- a/basics/tags/0.7.0/tests/one/src/main/resources/binding.xjb +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - diff --git a/basics/tags/0.7.0/tests/one/src/main/resources/schema.xsd b/basics/tags/0.7.0/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index e527b565..00000000 --- a/basics/tags/0.7.0/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.7.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.7.0/tests/one/src/test/resources/log4j.properties b/basics/tags/0.7.0/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.7.0/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/one/src/test/samples/1.xml b/basics/tags/0.7.0/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.7.0/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.7.0/tests/one/src/test/samples/2.xml b/basics/tags/0.7.0/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.7.0/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.7.0/tests/pom.xml b/basics/tags/0.7.0/tests/pom.xml deleted file mode 100644 index 02421168..00000000 --- a/basics/tags/0.7.0/tests/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.7.0 - ../pom.xml - - - episodes - one - issues - zj - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - generate - - generate - - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/wildcard/.classpath b/basics/tags/0.7.0/tests/wildcard/.classpath deleted file mode 100644 index fd1a8b60..00000000 --- a/basics/tags/0.7.0/tests/wildcard/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.7.0/tests/wildcard/.project b/basics/tags/0.7.0/tests/wildcard/.project deleted file mode 100644 index 4da28ca5..00000000 --- a/basics/tags/0.7.0/tests/wildcard/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - jaxb2-basics-test-wildcard - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.7.0/tests/wildcard/pom.xml b/basics/tags/0.7.0/tests/wildcard/pom.xml deleted file mode 100644 index f9b069f5..00000000 --- a/basics/tags/0.7.0/tests/wildcard/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.6.5 - ../pom.xml - - jaxb2-basics-test-wildcard - jar - JAXB2 Basics - Test [wildcard] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xwildcard - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.7.0/tests/wildcard/src/main/resources/binding.xjb b/basics/tags/0.7.0/tests/wildcard/src/main/resources/binding.xjb deleted file mode 100644 index 8f780f74..00000000 --- a/basics/tags/0.7.0/tests/wildcard/src/main/resources/binding.xjb +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/basics/tags/0.7.0/tests/wildcard/src/main/resources/schema.xsd b/basics/tags/0.7.0/tests/wildcard/src/main/resources/schema.xsd deleted file mode 100644 index 7d520ce9..00000000 --- a/basics/tags/0.7.0/tests/wildcard/src/main/resources/schema.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/zj/pom.xml b/basics/tags/0.7.0/tests/zj/pom.xml deleted file mode 100644 index 6d8d1e0a..00000000 --- a/basics/tags/0.7.0/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.0 - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.7.0/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.7.0/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.7.0/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.7.0/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.7.0/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.7.0/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.7.0/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.7.0/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.7.0/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.7.0/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.7.0/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.7.0/tools/.classpath b/basics/tags/0.7.0/tools/.classpath deleted file mode 100644 index 9c865fb7..00000000 --- a/basics/tags/0.7.0/tools/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.7.0/tools/.project b/basics/tags/0.7.0/tools/.project deleted file mode 100644 index e7b0094b..00000000 --- a/basics/tags/0.7.0/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.7.0/tools/pom.xml b/basics/tags/0.7.0/tools/pom.xml deleted file mode 100644 index c21c7a7a..00000000 --- a/basics/tags/0.7.0/tools/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - 0.7.0 - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.7.0 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - org.apache.commons - commons-lang3 - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index f67cc957..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!(namespaceURI== null || namespaceURI.length() == 0)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d3644156..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 176d5a2c..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,654 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(Outline outline, QName name) { - final CPluginCustomization customization = findCustomization(outline, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(Model model, QName name) { - final CPluginCustomization customization = findCustomization(model, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(EnumOutline enumOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - enumOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - Outline outline, QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CEnumLeafInfo enumLeafInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - enumLeafInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Outline outline, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(outline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Outline outline) { - return getCustomizations(outline.getModel()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index c65295d2..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public boolean isAlwaysSet() { - if (constantField != null) { - return true; - } else { - return JExpr.TRUE == fieldAccessor.hasSetValue(); - } - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - if (isAlwaysSet()) { - block.assign($var, targetObject.invoke(getter)); - } else { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index d484d493..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = parent.getParent().getClassOutline( - classInfo.getBaseTypeInfo()); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 15e216be..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 8178879e..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 0e5b4ec1..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index e2360338..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - generateClassOutline(modelOutline, modelInfo, - classInfo.getBaseTypeInfo()); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index b045735f..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index 344bc3f7..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 0b881e31..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - public XJCCMInfoFactory(Model model) { - super(model); - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - @Override - protected MContainer getContainer(CClassInfo info) { - final CClassInfoParent parent = info.parent(); - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CElementInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CEnumLeafInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - private final Map packages = new HashMap(); - - private MContainer getContainer(CClassInfoParent parent) { - return parent.accept(new Visitor() { - - public MContainer onBean(CClassInfo bean) { - return getTypeInfo(bean); - } - - public MContainer onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MContainer onElement(CElementInfo element) { - return getElementInfo(element); - } - }); - } - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected MClassInfo getScope(CClassInfo info) { - return info.getScope() == null ? null : getTypeInfo(info.getScope()); - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CElementInfo info) { - return info.shortName(); - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } - - private MPackageInfo getPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 28ed69a4..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index 51ee09b5..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); - - public boolean isAlwaysSet(); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index e977655d..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 033acf34..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 369c9768..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index d89918aa..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 11444b09..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index 96e82667..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index 85bd7b16..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index 67a576c1..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 41c9d885..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 74b7bd87..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index be5334e4..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index f4f9e307..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c8b7f118..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 91362018..00000000 --- a/basics/tags/0.7.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/tags/0.8.0/ant/.classpath b/basics/tags/0.8.0/ant/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.0/ant/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/ant/.project b/basics/tags/0.8.0/ant/.project deleted file mode 100644 index 63b92b0b..00000000 --- a/basics/tags/0.8.0/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.0/ant/pom.xml b/basics/tags/0.8.0/ant/pom.xml deleted file mode 100644 index 100212b8..00000000 --- a/basics/tags/0.8.0/ant/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.0 - ../pom.xml - - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.0/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.8.0/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.8.0/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.8.0/basic/.classpath b/basics/tags/0.8.0/basic/.classpath deleted file mode 100644 index 5d675fc8..00000000 --- a/basics/tags/0.8.0/basic/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/basic/.project b/basics/tags/0.8.0/basic/.project deleted file mode 100644 index 9ef5e932..00000000 --- a/basics/tags/0.8.0/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.0/basic/pom.xml b/basics/tags/0.8.0/basic/pom.xml deleted file mode 100644 index 2766d94f..00000000 --- a/basics/tags/0.8.0/basic/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.8.0 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.0 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - com.google.code.javaparser - javaparser - 1.0.8 - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.felix - - - maven-bundle-plugin - - - [2.3.7,) - - - manifest - - - - - - - - - - org.jvnet.jaxb2.maven2 - - - maven-jaxb2-plugin - - - [0.8.1,) - - - generate - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 176f243b..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(EnumOutline enumOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 0d007353..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(EnumOutline enumOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index ca56dce8..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,335 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String copyStrategyClass = JAXBCopyStrategy.class.getName(); - - public void setCopyStrategyClass(final String copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public String getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, - codeModel.ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, - codeModel.ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl( - JMod.FINAL, - theClass.owner().ref(Object.class), - "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), - JExpr.invoke("createNewInstance"), target)); - } else { - body._if(JExpr._null().eq(target)) - ._then() - ._throw(JExpr - ._new(theClass.owner().ref( - IllegalArgumentException.class)) - .arg("Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator) - .arg(draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", - JExpr.cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (!sourceFieldAccessor.isAlwaysSet() - && valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr - .invoke(copyStrategy, "copy") - .arg(theClass - .owner() - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), - copyFieldType.isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java deleted file mode 100644 index 0b550431..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/enumvalue"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java deleted file mode 100644 index 177a950c..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.EnumValue; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EnumValuePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XenumValue"; - } - - @Override - public String getUsage() { - return "Forces generated @XmlEnums implement the org.jvnet.jaxb2_commons.lang.EnumValue interface."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final EnumOutline enumOutline : outline.getEnums()) { - if (!getIgnoring().isIgnored(enumOutline)) { - processEnumOutline(enumOutline); - } - } - return true; - } - - protected void processEnumOutline(EnumOutline enumOutline) { - CEnumLeafInfo enumLeafInfo = enumOutline.target; - JClass enumType = enumLeafInfo.base.toType(enumOutline.parent(), - Aspect.EXPOSED).boxify(); - - final JDefinedClass theClass = enumOutline.clazz; - - ClassUtils._implements(theClass, theClass.owner().ref(EnumValue.class) - .narrow(enumType)); - - final JMethod enumValue$enumValue = theClass.method(JMod.PUBLIC, - enumType, "enumValue"); - enumValue$enumValue.body()._return(JExpr._this().invoke("value")); - } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 5d35be2b..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); - - public void setEqualsStrategyClass(String equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public String getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - // - // @SuppressWarnings("unused") - // final JMethod equals$equals = generateEquals$equals(enumOutline, - // theClass); - // } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } - - // protected JMethod generateEquals$equals(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // final JCodeModel codeModel = theClass.owner(); - // final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - // "equals"); - // - // { - // final JBlock body = equals.body(); - // final JVar leftLocator = equals.param(ObjectLocator.class, - // "thisLocator"); - // final JVar rightLocator = equals.param(ObjectLocator.class, - // "thatLocator"); - // final JVar object = equals.param(Object.class, "object"); - // final JVar equalsStrategy = equals.param(EqualsStrategy.class, - // "strategy"); - // - // body._return(equalsStrategy - // .invoke("equals") - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(leftLocator) - // .arg("value").arg(JExpr._this().ref("value"))) - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(rightLocator) - // .arg("value").arg(object.ref("value"))) - // .arg(JExpr._this().ref("value")).arg(object.ref("value"))); - // - // } - // return equals; - // } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index 571b6fbe..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); - - public void setHashCodeStrategyClass(String hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public String getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - // - // // @SuppressWarnings("unused") - // // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode = generateHashCode$hashCode( - // enumOutline, theClass); - // // @SuppressWarnings("unused") - // // final JMethod object$hashCode = generateObject$hashCode(enumOutline, - // // theClass); - // } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - return generateObject$hashCode(theClass); - } - - // protected JMethod generateObject$hashCode(final EnumOutline enumOutline, - // final JDefinedClass theClass) { - // return generateObject$hashCode(theClass); - // } - - private JMethod generateObject$hashCode(final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, - theClass.owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass - .owner().ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl( - fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign( - currentHashCode, - hashCodeStrategy - .invoke("hashCode") - .arg(codeModel - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(theValue)) - .arg(currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } - - // protected JMethod generateHashCode$hashCode(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // JCodeModel codeModel = theClass.owner(); - // final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - // codeModel.INT, "hashCode"); - // final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - // "locator"); - // final JVar hashCodeStrategy = hashCode$hashCode.param( - // HashCodeStrategy.class, "strategy"); - // final JBlock body = hashCode$hashCode.body(); - // - // body._return(hashCodeStrategy - // .invoke("hashCode") - // .arg(codeModel.ref(LocatorUtils.class).staticInvoke("property") - // .arg(locator).arg("value") - // .arg(JExpr._this().ref("value"))).arg(JExpr.lit(1)) - // .arg(JExpr._this().ref("value"))); - // - // return hashCode$hashCode; - // } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index 0d8c96ec..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIEnum; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - final Map knownClasses = new HashMap(); - final Map knownClassInfos = new IdentityHashMap(); - - for (final ClassOutline classOutline : outline.getClasses()) { - knownClasses.put(classOutline.implClass.fullName(), - classOutline.implClass); - knownClassInfos.put(classOutline.implClass, classOutline.target); - } - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, knownClasses, knownClassInfos); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, knownClasses); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, knownClasses); - } - } - processPackageOutlines(outline, knownClasses); - return true; - } - - private void processClassOutline(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - - generateExtends(classOutline, knownClasses, knownClassInfos); - generateImplements(classOutline, knownClasses); - - } - - private void processEnumOutline(EnumOutline enumOutline, - Map knownClasses) { - - generateExtends(enumOutline, knownClasses); - generateImplements(enumOutline, knownClasses); - - } - - private void processElementOutline(ElementOutline elementOutline, - Map knownClasses) { - - generateExtends(elementOutline, knownClasses); - generateImplements(elementOutline, knownClasses); - - } - - private void processPackageOutlines(Outline outline, - Map knownClasses) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass, - knownClasses); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface, knownClasses); - } - } - } - } - } - } - } - } - - private JClass generateExtends(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - JClass targetClass = generateExtends(theClass, - extendsClassCustomization, knownClasses); - - final CClassInfo classInfo = classOutline.target; - if (targetClass != null && classInfo.getBaseClass() == null - && classInfo.getRefBaseClass() == null) { - final CClassInfo targetClassInfo = knownClassInfos.get(targetClass); - if (targetClassInfo == null && classInfo.getRefBaseClass() == null) { - final Model model = classInfo.model; - // BIEnum as BIClass is protected too much - final BIEnum decl = new BIEnum(); - decl.ref = targetClass.fullName(); - final CClassRef baseClass = new CClassRef(model, - classInfo.getSchemaComponent(), decl, - new CCustomizations()); - classInfo.setBaseClass(baseClass); - } else if (targetClassInfo != null - && classInfo.getBaseClass() == null) { - classInfo.setBaseClass(targetClassInfo); - } - } - return targetClass; - } - - private JClass generateExtends(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization, - Map knownClasses) throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - return generateExtends(theClass, extendsClass, knownClasses); - } else { - return null; - } - } - - private JClass generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass, Map knownClasses) { - if (extendsClass.getClassName() != null) { - final String _class = extendsClass.getClassName(); - final JClass targetClass = parseClass(_class, theClass.owner(), - knownClasses); - theClass._extends(targetClass); - return targetClass; - } else { - return null; - } - } - - private List generateImplements(ClassOutline classOutline, - Map knownClasses) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations, - Map knownClasses) throws AssertionError { - final List implementedInterfaces = new ArrayList( - implementsInterfaceCustomizations.size()); - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - - final JClass implementedInterface = generateImplements( - theClass, implementsInterface, knownClasses); - if (implementedInterface != null) { - implementedInterfaces.add(implementedInterface); - } - } - } - return implementedInterfaces; - } - - private JClass generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface, - Map knownClasses) { - - String _interface = implementsInterface.getInterfaceName(); - if (_interface != null) { - final JClass targetClass = parseClass(_interface, theClass.owner(), - knownClasses); - theClass._implements(targetClass); - return targetClass; - } else { - return null; - } - } - - private JClass parseClass(String _class, JCodeModel codeModel, - Map knownClasses) { - return new JavaTypeParser(knownClasses).parseClass(_class, codeModel); - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java deleted file mode 100644 index 5fa73bc2..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.JavaParser; -import japa.parser.ParseException; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class JavaTypeParser { - - static { - JavaParser.setCacheParser(false); - } - - private final TypeToJTypeConvertingVisitor typeToJTypeConvertingVisitor; - - public JavaTypeParser() { - this(Collections. emptyMap()); - } - - public JavaTypeParser(Map knownClasses) { - Validate.notNull(knownClasses); - this.typeToJTypeConvertingVisitor = new TypeToJTypeConvertingVisitor( - knownClasses); - - } - - public JClass parseClass(String _class, JCodeModel codeModel) { - JType type = parseType(_class, codeModel); - if (type instanceof JClass) { - return (JClass) type; - } else { - throw new IllegalArgumentException("Type [" + _class - + "] is not a class."); - } - } - - private JType parseType(String type, JCodeModel codeModel) { - final String text = "public class Ignored extends " + type + " {}"; - try { - CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - final List _extended = classDeclaration - .getExtends(); - final ClassOrInterfaceType classOrInterfaceType = _extended.get(0); - - return classOrInterfaceType.accept( - this.typeToJTypeConvertingVisitor, codeModel); - } catch (ParseException pex) { - throw new IllegalArgumentException( - "Could not parse the type definition [" + type + "].", pex); - } catch (UnsupportedEncodingException uex) { - throw new UnsupportedOperationException(uex); - } - } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java deleted file mode 100644 index 021d97b3..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; -import japa.parser.ast.visitor.GenericVisitorAdapter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class TypeToJTypeConvertingVisitor extends - GenericVisitorAdapter { - - private final Map knownClasses; - - public TypeToJTypeConvertingVisitor(Map knownClasses) { - Validate.notNull(knownClasses); - this.knownClasses = knownClasses; - } - - @Override - public JType visit(VoidType type, JCodeModel codeModel) { - return codeModel.VOID; - } - - @Override - public JType visit(PrimitiveType type, JCodeModel codeModel) { - switch (type.getType()) { - case Boolean: - return codeModel.BOOLEAN; - case Char: - return codeModel.CHAR; - case Byte: - return codeModel.BYTE; - case Short: - return codeModel.SHORT; - case Int: - return codeModel.INT; - case Long: - return codeModel.LONG; - case Float: - return codeModel.FLOAT; - case Double: - return codeModel.DOUBLE; - default: - throw new AssertionError("Unknown primitive type [" - + type.getType() + "]"); - } - } - - @Override - public JType visit(ReferenceType type, JCodeModel codeModel) { - final JType referencedType = type.getType().accept(this, codeModel); - - JType referencedTypeArray = referencedType; - for (int index = 0; index < type.getArrayCount(); index++) { - referencedTypeArray = referencedTypeArray.array(); - } - return referencedTypeArray; - } - - @Override - public JType visit(WildcardType type, JCodeModel codeModel) { - - if (type.getExtends() != null) { - final ReferenceType _extends = type.getExtends(); - final JType boundType = _extends.accept(this, codeModel); - - if (!(boundType instanceof JClass)) { - throw new IllegalArgumentException("Bound type [" + _extends - + "]in the wildcard type must be class."); - } - - final JClass boundClass = (JClass) boundType; - return boundClass.wildcard(); - } else if (type.getSuper() != null) { - // TODO - throw new IllegalArgumentException( - "Wildcard types with super clause are not supported at the moment."); - } else { - throw new IllegalArgumentException( - "Wildcard type must have either extends or super clause."); - } - } - - @Override - public JType visit(ClassOrInterfaceType type, JCodeModel codeModel) { - final String name = getName(type); - final JClass knownClass = this.knownClasses.get(name); - final JClass jclass = knownClass != null ? knownClass : codeModel - .ref(name); - final List typeArgs = type.getTypeArgs(); - if (typeArgs == null || typeArgs.isEmpty()) { - return jclass; - } else { - final List jtypeArgs = new ArrayList( - typeArgs.size()); - for (Type typeArg : typeArgs) { - final JType jtype = typeArg.accept(this, codeModel); - if (!(jtype instanceof JClass)) { - throw new IllegalArgumentException("Type argument [" - + typeArg.toString() + "] is not a class."); - } else { - jtypeArgs.add((JClass) jtype); - } - } - return jclass.narrow(jtypeArgs); - } - } - - private String getName(ClassOrInterfaceType type) { - final String name = type.getName(); - final ClassOrInterfaceType scope = type.getScope(); - if (scope == null) { - return name; - } else { - return getName(scope) + "." + name; - } - } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index c83e1901..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); - - public void setMergeStrategyClass( - final String mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public String getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index fbc662d6..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - public static enum Mode { - - accessor { - - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(setter.body()); - accessor.fromRawValue(setter.body(), "draft", value); - } - }, - direct { - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - - final JFieldVar field = theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - - if (field != null) { - setter.body().assign(JExpr._this().ref(field), value); - } else { - // Fallback to the accessor - Mode.accessor.generateSetter(fieldOutline, theClass, - setter, value); - } - } - }; - public abstract void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value); - } - - private Mode mode = Mode.accessor; - - public String getMode() { - return mode.name(); - - } - - public void setMode(String mode) { - Validate.notNull(mode); - try { - this.mode = Mode.valueOf(mode); - } catch (IllegalArgumentException iaex) { - throw new IllegalArgumentException( - "Unsupported mode [" - + mode - + "]." - + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" - + " and [direct] (assigns the value to the field directly)."); - } - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - - mode.generateSetter(fieldOutline, theClass, - generatedSetter, value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java deleted file mode 100644 index 783cf37b..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - - public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-element-property"); - - public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-reference-property"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java deleted file mode 100644 index 97de9dd7..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeRef; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.ID; - -public class SimplifyPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xsimplify"; - } - - @Override - public String getUsage() { - return "This plugin allows simplifying \"complex\" properties" - + " (ex. aOrBOrC generated from repeatable choices)" - + " into several \"simple\" properties (ex. a, b, c).\n" - + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" - + " for plugin documentation."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public void postProcessModel(final Model model, ErrorHandler errorHandler) { - - for (final CClassInfo classInfo : model.beans().values()) { - postProcessClassInfo(model, classInfo); - } - } - - private void postProcessClassInfo(final Model model, - final CClassInfo classInfo) { - final List properties = new ArrayList( - classInfo.getProperties()); - for (CPropertyInfo property : properties) { - property.accept(new CPropertyVisitor() { - - public Void onElement(CElementPropertyInfo elementProperty) { - postProcessElementPropertyInfo(model, classInfo, - elementProperty); - return null; - } - - public Void onAttribute(CAttributePropertyInfo attributeProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onValue(CValuePropertyInfo valueProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onReference(CReferencePropertyInfo p) { - postProcessReferencePropertyInfo(model, classInfo, p); - return null; - } - - }); - } - } - - private void postProcessElementPropertyInfo(final Model model, - final CClassInfo classInfo, CElementPropertyInfo property) { - if (property.isCollection() && property.getTypes().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyElementPropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } - } - } - - private void postProcessReferencePropertyInfo(final Model model, - final CClassInfo classInfo, CReferencePropertyInfo property) { - if (property.isCollection() && property.getElements().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } else if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsReferencePropertyInfo(model, - classInfo, property); - } - } - } - - private void simplifyElementPropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CElementPropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CTypeRef typeRef : property.getTypes()) { - final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( - model, property, typeRef); - classInfo.getProperties().add(index++, elementPropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsReferencePropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( - model, property, element); - classInfo.getProperties().add(index++, referencePropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CElementPropertyInfo elementPropertyInfo; - if (element instanceof CElementInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CElementInfo) element); - } else if (element instanceof CClassInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CClassInfo) element); - - } else if (element instanceof CClassRef) { - // elementPropertyInfo = createElementPropertyInfo(model, - // element, - // (CClassRef) element); - elementPropertyInfo = null; - // TODO WARN - - } else { - // TODO WARN - elementPropertyInfo = null; - } - if (elementPropertyInfo != null) { - classInfo.getProperties().add(index++, elementPropertyInfo); - } - } - classInfo.getProperties().remove(property); - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CElementInfo elementInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(elementInfo.getContentType(), element - .getElementName(), elementInfo.getContentType() - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CClassInfo classInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(classInfo, element.getElementName(), classInfo - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - // private CElementPropertyInfo createElementPropertyInfo(final Model model, - // CElement element, final CClassRef cr) { - // final CElementPropertyInfo elementPropertyInfo; - // final String propertyName = createPropertyName(model, element); - // elementPropertyInfo = new CElementPropertyInfo(propertyName, - // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - // element.getSchemaComponent(), element.getCustomizations(), - // element.getLocator(), false); - // elementPropertyInfo.getTypes().add( - // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), - // false, null)); - // return elementPropertyInfo; - // } - - private CReferencePropertyInfo createReferencePropertyInfo( - final Model model, CReferencePropertyInfo property, CElement element) { - final String propertyName = createPropertyName(model, element); - final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( - propertyName, true, false, property.isMixed(), - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), property.isDummy(), property.isContent(), - property.isMixedExtendedCust()); - referencePropertyInfo.getElements().add(element); - return referencePropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElementPropertyInfo property, CTypeRef typeRef) { - final String propertyName = createPropertyName(model, typeRef); - boolean required = false; - final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( - propertyName, CollectionMode.REPEATED_ELEMENT, typeRef - .getTarget().idUse(), typeRef.getTarget() - .getExpectedMimeType(), property.getSchemaComponent(), - property.getCustomizations(), property.getLocator(), required); - elementPropertyInfo.getTypes().add(typeRef); - return elementPropertyInfo; - } - - private String createPropertyName(final Model model, CElement element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getElementName().getLocalPart()); - return propertyName; - } - - private String createPropertyName(final Model model, CTypeRef element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getTagName().getLocalPart()); - return propertyName; - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index dc8eac3c..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); - - public void setToStringStrategyClass( - String toStringStrategy) { - this.toStringStrategyClass = toStringStrategy; - } - - public String getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 6f95d0b1..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final String strategyClassName) { - - try { - final Class strategyClass = Class.forName(strategyClassName); - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } catch (ClassNotFoundException cnfex) { - final JClass strategyJClass = codeModel.ref(strategyClassName); - return JExpr._new(strategyJClass); - } - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index b44a1cb3..00000000 --- a/basics/tags/0.8.0/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - final boolean laxModel = CustomizationUtils.containsCustomization( - model, Customizations.LAX_ELEMENT_NAME); - final boolean skipModel = CustomizationUtils.containsCustomization( - model, Customizations.SKIP_ELEMENT_NAME); - final boolean strictModel = CustomizationUtils.containsCustomization( - model, Customizations.STRICT_ELEMENT_NAME); - for (CClassInfo classInfo : model.beans().values()) { - final boolean laxClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.STRICT_ELEMENT_NAME); - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - final boolean laxPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME); - - if (laxModel) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipModel) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictModel) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.8.0/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.8.0/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 99ef7147..00000000 --- a/basics/tags/0.8.0/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,13 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin -org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin -org.jvnet.jaxb2_commons.plugin.enumvalue.EnumValuePlugin \ No newline at end of file diff --git a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java b/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java deleted file mode 100644 index 30bdf587..00000000 --- a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; - -public class JavaParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final JavaTypeParser javaTypeParser = new JavaTypeParser(); - final JCodeModel codeModel = new JCodeModel(); - JClass comparator = javaTypeParser.parseClass("java.util.Comparator", - codeModel); - assertNotNull(comparator); - JClass integerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(integerComparator); - JClass wildcardIntegerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(wildcardIntegerComparator); - } -} diff --git a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java b/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java deleted file mode 100644 index a2562048..00000000 --- a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; - -import java.io.ByteArrayInputStream; -import java.util.List; - -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - assertEquals(1, typeDeclarations.size()); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - assertEquals("Dummy", classDeclaration.getName()); - final List implementedInterfaces = classDeclaration - .getImplements(); - assertEquals(1, implementedInterfaces.size()); - final ClassOrInterfaceType implementedInterface = implementedInterfaces - .get(0); - assertEquals("Comparator", implementedInterface.getName()); - final List typeArgs = implementedInterface.getTypeArgs(); - assertEquals(1, typeArgs.size()); - final Type typeArg = typeArgs.get(0); - assertTrue(typeArg instanceof ReferenceType); - final ReferenceType referenceTypeArg = (ReferenceType) typeArg; - final Type referencedType = referenceTypeArg.getType(); - assertTrue(referencedType instanceof ClassOrInterfaceType); - final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; - assertEquals("Integer", typeArgType.getName()); - - } -} diff --git a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.8.0/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.8.0/basic/src/test/resources/schema.xsd b/basics/tags/0.8.0/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.8.0/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/build-1.6.bat b/basics/tags/0.8.0/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.8.0/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.0/deploy.bat b/basics/tags/0.8.0/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/tags/0.8.0/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/tags/0.8.0/dist/pom.xml b/basics/tags/0.8.0/dist/pom.xml deleted file mode 100644 index a2ea5204..00000000 --- a/basics/tags/0.8.0/dist/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.0 - ../pom.xml - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/dist - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - diff --git a/basics/tags/0.8.0/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.8.0/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.8.0/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.8.0/dist/src/main/assembly/dist.xml b/basics/tags/0.8.0/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.8.0/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.8.0/install-1.6.bat b/basics/tags/0.8.0/install-1.6.bat deleted file mode 100644 index 57a75b67..00000000 --- a/basics/tags/0.8.0/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -Psamples,tests,dist clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.0/install.bat b/basics/tags/0.8.0/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/tags/0.8.0/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/tags/0.8.0/jaxb/pom.xml b/basics/tags/0.8.0/jaxb/pom.xml deleted file mode 100644 index 2ad49ae7..00000000 --- a/basics/tags/0.8.0/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 7 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/jaxb/release.bat b/basics/tags/0.8.0/jaxb/release.bat deleted file mode 100644 index e6784200..00000000 --- a/basics/tags/0.8.0/jaxb/release.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn clean deploy -DperformRelease=true -Psonatype-oss-release \ No newline at end of file diff --git a/basics/tags/0.8.0/jaxb/xjc/pom.xml b/basics/tags/0.8.0/jaxb/xjc/pom.xml deleted file mode 100644 index a2a60692..00000000 --- a/basics/tags/0.8.0/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.4 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/pom.xml b/basics/tags/0.8.0/pom.xml deleted file mode 100644 index c5a38687..00000000 --- a/basics/tags/0.8.0/pom.xml +++ /dev/null @@ -1,334 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.8.0 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/trunk - - - ant - runtime - tools - testing - basic - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - dist - - - dist - - - - dist - - - - - 2.2.5-2 - 0.8.2 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb.version} - - - - junit - junit - 3.8.1 - - - - org.apache.commons - commons-lang3 - 3.2.1 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.6 - 1.6 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.8.0/release.bat b/basics/tags/0.8.0/release.bat deleted file mode 100644 index ca58cfd7..00000000 --- a/basics/tags/0.8.0/release.bat +++ /dev/null @@ -1,76 +0,0 @@ -setlocal -echo Setting JAVA_HOME to %JAVA6_HOME%. -set JAVA_HOME=%JAVA6_HOME% - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -DperformRelease -Psamples,tests,dist -echo Full clean build completed. -pause - -echo Setting new version to %1. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 -echo Version was set to %1. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %1 committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -Psamples,tests,dist -DperformRelease -echo Full clean build completed. -pause - -echo Checking in version %1. -pause -call mvn scm:checkin -Dmessage="Version %1" -echo Version %1 was checked in. -pause - -echo Tagging version %1. -pause -call mvn scm:tag -Dtag=%1 -echo Version %1 was tagged. -pause - -echo Performing full clean deploy. -pause -call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy -echo Full clean deploy done. -pause - -echo Setting new version to %2. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 -echo Version was set to %2. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %2 was committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -pause - -echo Checking in version %2. -pause -call mvn scm:checkin -Dmessage="Version %2" -echo Version %2 was checked in. -pause - -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.0/runtime/.classpath b/basics/tags/0.8.0/runtime/.classpath deleted file mode 100644 index 5d675fc8..00000000 --- a/basics/tags/0.8.0/runtime/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/runtime/pom.xml b/basics/tags/0.8.0/runtime/pom.xml deleted file mode 100644 index abe2f8d6..00000000 --- a/basics/tags/0.8.0/runtime/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - 0.8.0 - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.0 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - - - bundle-manifest - process-classes - - manifest - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index d66a74b7..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,371 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else if (lhs instanceof Equals[]) { - return equalsInternal(leftLocator, rightLocator, (Equals[]) lhs, - (Equals[]) rhs); - } else if (lhs instanceof Enum[]) { - return equalsInternal(leftLocator, rightLocator, (Enum[]) lhs, - (Enum[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else if (lhs instanceof Enum) { - return equalsInternal(leftLocator, rightLocator, (Enum) lhs, (Enum) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum lhs, Enum rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals lhs, Equals rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - return lhs.equals(leftLocator, rightLocator, rhs, this); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals[] left, Equals[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum[] left, Enum[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index e54659cd..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else if (object instanceof HashCode[]) { - return hashCodeInternal(locator, hashCode, (HashCode[]) object); - } else if (object instanceof Enum[]) { - return hashCodeInternal(locator, hashCode, (Enum[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else if (value instanceof Enum) { - return hashCodeInternal(locator, hashCode, (Enum) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode object) { - if (object == null) { - return hashCode * iConstant; - } else { - return hashCode * iConstant + object.hashCode(locator, this); - } - } - - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java deleted file mode 100644 index 9e843b88..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public interface EnumValue { - - public T enumValue(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index a6c06704..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 88b3cce7..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - // Treat empty lists as nulls - if (list.isEmpty()) { - return super.hashCode(locator, hashCode, (Object) null); - } else { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 8407ab35..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - public String getPathAsString() { - final String stepAsString = getStepAsString(); - final ObjectLocator parentLocator = getParentLocator(); - return parentLocator == null ? stepAsString : parentLocator - .getPathAsString() + stepAsString; - } - - protected abstract String getStepAsString(); - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - - // public Object[] getMessageParameters() { - // return new Object[] { getObject() }; - // } - // - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() + ".messages")); - } - - // public int hashCode() { - // int hashCode = getObject().hashCode(); - // return hashCode; - // } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index ce0d32ff..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "[" + getIndex() + "]"; - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index 0484223a..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "." + getPropertyName(); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index ecd6fc3e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return ""; - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 37aa8555..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * @return Path to this locator in string form; - */ - public String getPathAsString(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index 57cecb8e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MClassTypeInfo, - MOriginated { - - public MClassTypeInfo getBaseTypeInfo(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java deleted file mode 100644 index 963d4734..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassRef extends MClassTypeInfo { -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java deleted file mode 100644 index fb396a97..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassTypeInfo extends MPackagedTypeInfo, - MContainer { - - public C getTargetClass(); - - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java deleted file mode 100644 index 47d7b23e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassTypeInfoVisitor { - - public V visitClassInfo(MClassInfo info); - - public V visitClassRef(MClassRef info); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java deleted file mode 100644 index 73f92248..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContained { - - public MContainer getContainer(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java deleted file mode 100644 index e55cac10..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContainer extends MPackaged { - - public String getLocalName(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java deleted file mode 100644 index 1a673485..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomizable { - - public MCustomizations getCustomizations(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java deleted file mode 100644 index 3e32cc52..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomization { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java deleted file mode 100644 index b20537dc..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MCustomizations { - - public List getCustomizations(); - - public void addCustomization(MCustomization customization); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index 6c72d310..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated, MContained, MContainer { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java deleted file mode 100644 index 4a43b435..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MID extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java deleted file mode 100644 index 49ca1c30..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREF extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java deleted file mode 100644 index 1f0b2084..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREFS extends MList { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 9e0b5b8c..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MCustomizable, - MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 6ea7fe61..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated, - MContainer { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 7c7571b9..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged, - MContained { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index 0d628be5..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitID(MID info) { - return null; - } - - public V visitIDREF(MIDREF info) { - return null; - } - - public V visitIDREFS(MIDREFS info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 98a86bc7..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo extends MCustomizable { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 8b2d1e4b..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor extends - MClassTypeInfoVisitor { - - public V visitList(MList info); - - public V visitID(MID info); - - public V visitIDREF(MIDREF info); - - public V visitIDREFS(MIDREFS info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 6dd77b37..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - private final MCustomizations customizations = new CMCustomizations(); - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index bdc4a89a..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - private final MClassTypeInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MClassTypeInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getContainer(), getLocalName(), - getElementName(), scope, this, substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MContainer getScope() { - return container; - } - - public MClassTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } - - @Override - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java deleted file mode 100644 index a64ba452..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMClassRef implements MClassRef { - - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - - public CMClassRef(/* MClassInfoOrigin origin, */C targetClass, - MPackageInfo _package, MContainer container, String localName) { - super(); - // Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - // this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public T getTargetType() { - return targetClass; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassRef(this); - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public C getTargetClass() { - return targetClass; - } - - @Override - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor) { - return visitor.visitClassRef(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java deleted file mode 100644 index 6e09ab64..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.w3c.dom.Element; - -public class CMCustomization implements MCustomization { - - private final Element element; - - public CMCustomization(Element element) { - this.element = element; - } - - public Element getElement() { - return element; - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java deleted file mode 100644 index c7bfa857..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; - -public class CMCustomizations implements MCustomizations { - - private final List customizations = new LinkedList(); - private final List unmodifiableCustomizations = Collections - .unmodifiableList(this.customizations); - - public List getCustomizations() { - return unmodifiableCustomizations; - } - - public void addCustomization(MCustomization customization) { - Validate.notNull(customization); - this.customizations.add(customization); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index e539fd75..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final MContainer container; - - private final String localName; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - MContainer container, String localName, QName elementName, - MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.container = container; - this.localName = localName; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getLocalName() { - return localName; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index d25eb09e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 47a598a2..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo, - MCustomizable { - - private final MEnumLeafInfoOrigin origin; - private final CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final MContainer container; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.container = container; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), - getContainer(), - getLocalName(), - getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java deleted file mode 100644 index 5daa634c..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMID implements MID { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMID(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitID(this); - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java deleted file mode 100644 index 2eaeacde..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMIDREF implements MIDREF { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMIDREF(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREF(this); - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java deleted file mode 100644 index accf9d52..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMIDREFS extends CMList implements MIDREFS { - - public CMIDREFS(T targetType, MTypeInfo itemTypeInfo) { - super(targetType, itemTypeInfo); - } - - @Override - public String toString() { - return MessageFormat.format("IDREFS [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREFS(this); - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index 8fecc6d6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,519 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - - if (list) { - switch (id) { - case ID: - final MTypeInfo tid = new CMID(ti.getTargetType(), - ti); - return new CMList(createListType(tid.getTargetType()), - tid); - case IDREF: - return new CMIDREFS(createListType(ti.getTargetType()), - ti); - default: - return new CMList(createListType(ti.getTargetType()), ti); - } - } else { - switch (id) { - case ID: - return new CMID(ti.getTargetType(), ti); - case IDREF: - return new CMIDREF(ti.getTargetType(), ti); - default: - return ti; - } - } - - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - protected MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), createBaseTypeInfo(info), - info.isElement() ? info.getElementName() : null); - } - - protected MClassTypeInfo createBaseTypeInfo(CI info) { - return info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MClassInfo getScope(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract String getLocalName(EI info); - - protected abstract MPackageInfo getPackage(EI info); - - protected abstract MContainer getContainer(CI info); - - protected abstract MContainer getContainer(EI info); - - protected abstract MContainer getContainer(ELI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), getTypeInfo(baseType), - info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - getContainer(element), getLocalName(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 1e50748c..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index e3ee1ebd..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final CMCustomizations customizations = new CMCustomizations(); - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 85cc5a38..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - - public String getLocalName() { - return null; - } - - public String getContainerLocalName(String delimiter) { - return null; - } - - public MPackageInfo getPackageInfo() { - return this; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index 196a11bd..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo, - MCustomizable { - - private CMCustomizations customizations = new CMCustomizations(); - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index 5f9236b9..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - private final MCustomizations customizations = new CMCustomizations(); - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index c92e2e84..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitID(MID info) { - return visitTypeInfo(info); - } - - public V visitIDREF(MIDREF info) { - return visitTypeInfo(info); - } - - public V visitIDREFS(MIDREFS info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } - - public V visitClassRef(MClassRef info) { - return visitTypeInfo(info); - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java deleted file mode 100644 index 43c96d12..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -public class PackageInfoQNameAnalyzer { - - private final MModelInfo modelInfo; - - public PackageInfoQNameAnalyzer(MModelInfo modelInfo) { - Validate.notNull(modelInfo); - this.modelInfo = modelInfo; - } - - public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - counter.add(name.getNamespaceURI()); - } - - public void attribute(QName name) { - - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - } - - public void attribute(QName name) { - counter.add(name.getNamespaceURI()); - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - private void collectNamespaceURIs(MPackageInfo packageInfo, - final QNameCollector collector) { - for (MElementInfo elementInfo : modelInfo.getElementInfos()) { - if (elementInfo.getPackageInfo() == packageInfo) { - collector.element(elementInfo.getElementName()); - } - } - - final QNameCollectingPropertyInfoVisitor visitor = new QNameCollectingPropertyInfoVisitor( - collector); - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - if (classInfo.getPackageInfo() == packageInfo) { - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - propertyInfo.acceptPropertyInfoVisitor(visitor); - } - } - } - } - - private static class NamespaceURICounter { - private Map map = new HashMap(); - - public void add(String namespaceURI) { - final Integer count = map.get(namespaceURI); - if (count == null) { - map.put(namespaceURI, Integer.valueOf(1)); - } else { - map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); - } - } - - public String getMostUsedNamespaceURI() { - String namespaceURI = null; - int count = 0; - - for (Map.Entry e : map.entrySet()) { - final String currentNamespaceURI = e.getKey(); - final int currentCount = e.getValue(); - if (namespaceURI == null) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } else { - if (currentCount > count - || (currentCount == count && namespaceURI == null)) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } - } - } - - return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; - - } - - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java deleted file mode 100644 index 6729008e..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class QNameCollectingPropertyInfoVisitor implements - MPropertyInfoVisitor { - - private final QNameCollector collector; - - public QNameCollectingPropertyInfoVisitor(QNameCollector collector) { - Validate.notNull(collector); - this.collector = collector; - } - - public Void visitElementPropertyInfo(MElementPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementsPropertyInfo(MElementsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } - - public Void visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return null; - } - - public Void visitAttributePropertyInfo(MAttributePropertyInfo info) { - collector.attribute(info.getAttributeName()); - return null; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - return null; - } - - public Void visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java deleted file mode 100644 index 2bd50907..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -public interface QNameCollector { - - public void element(QName name); - - public void attribute(QName name); -} diff --git a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.8.0/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.8.0/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.8.0/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.8.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.8.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.8.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.8.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.8.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.8.0/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.8.0/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.8.0/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.8.0/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/basic/pom.xml b/basics/tags/0.8.0/samples/basic/pom.xml deleted file mode 100644 index fe9b70b8..00000000 --- a/basics/tags/0.8.0/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.8.0 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/basic/project-build.xml b/basics/tags/0.8.0/samples/basic/project-build.xml deleted file mode 100644 index 05001052..00000000 --- a/basics/tags/0.8.0/samples/basic/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/basic/project-pom.xml b/basics/tags/0.8.0/samples/basic/project-pom.xml deleted file mode 100644 index 2909b2d1..00000000 --- a/basics/tags/0.8.0/samples/basic/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/basic/src/main/assembly/src.xml b/basics/tags/0.8.0/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.8.0/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.8.0/samples/basic/src/main/java/.placeholder b/basics/tags/0.8.0/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.0/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.8.0/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.8.0/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.8.0/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.0/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.8.0/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.0/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/basic/src/test/samples/1.xml b/basics/tags/0.8.0/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.0/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.0/samples/modular-ant/pom.xml b/basics/tags/0.8.0/samples/modular-ant/pom.xml deleted file mode 100644 index 6cc2d576..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4-SNAPSHOT - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/modular-ant/project-build.xml b/basics/tags/0.8.0/samples/modular-ant/project-build.xml deleted file mode 100644 index a2fc3e3a..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.8.0/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.8.0/samples/modular-ant/src/main/java/.placeholder b/basics/tags/0.8.0/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.0/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.8.0/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.0/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.8.0/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.8.0/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.0/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.0/samples/po/pom.xml b/basics/tags/0.8.0/samples/po/pom.xml deleted file mode 100644 index 0206b9a0..00000000 --- a/basics/tags/0.8.0/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.8.0 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/po/project-build.xml b/basics/tags/0.8.0/samples/po/project-build.xml deleted file mode 100644 index 4523094a..00000000 --- a/basics/tags/0.8.0/samples/po/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/po/project-pom.xml b/basics/tags/0.8.0/samples/po/project-pom.xml deleted file mode 100644 index edf3ced9..00000000 --- a/basics/tags/0.8.0/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/po/src/main/java/.placeholder b/basics/tags/0.8.0/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.0/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.8.0/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.8.0/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.8.0/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.8.0/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.8.0/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.8.0/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.0/samples/po/src/test/resources/log4j.properties b/basics/tags/0.8.0/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.0/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/po/src/test/samples/po.xml b/basics/tags/0.8.0/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.8.0/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/pom.xml b/basics/tags/0.8.0/samples/pom.xml deleted file mode 100644 index bb849c40..00000000 --- a/basics/tags/0.8.0/samples/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.0 - ../pom.xml - - - po - basic - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/samples/src/main/assembly/ant-src.xml b/basics/tags/0.8.0/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.8.0/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.8.0/samples/src/main/assembly/maven-src.xml b/basics/tags/0.8.0/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.8.0/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.8.0/testing/.classpath b/basics/tags/0.8.0/testing/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.0/testing/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/testing/.project b/basics/tags/0.8.0/testing/.project deleted file mode 100644 index 4ead1953..00000000 --- a/basics/tags/0.8.0/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.0/testing/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.0/testing/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a8..00000000 --- a/basics/tags/0.8.0/testing/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.0/testing/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.0/testing/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.0/testing/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.0/testing/pom.xml b/basics/tags/0.8.0/testing/pom.xml deleted file mode 100644 index 1f19b88d..00000000 --- a/basics/tags/0.8.0/testing/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.0 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.0/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.8.0/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.8.0/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.8.0/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.8.0/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.8.0/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.8.0/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.8.0/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.8.0/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.8.0/testing/src/test/samples/1.xml b/basics/tags/0.8.0/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/tags/0.8.0/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.8.0/testing/src/test/samples/2.xml b/basics/tags/0.8.0/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/tags/0.8.0/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/build-1.5.bat b/basics/tags/0.8.0/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.8.0/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/build-1.6.bat b/basics/tags/0.8.0/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.8.0/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/episodes/a/pom.xml b/basics/tags/0.8.0/tests/episodes/a/pom.xml deleted file mode 100644 index 722e41f6..00000000 --- a/basics/tags/0.8.0/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.8.0 - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.8.0/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.8.0/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.8.0/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.8.0/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.8.0/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.8.0/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.8.0/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/episodes/b/pom.xml b/basics/tags/0.8.0/tests/episodes/b/pom.xml deleted file mode 100644 index 0674ed38..00000000 --- a/basics/tags/0.8.0/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.8.0 - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.8.0/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.8.0/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.8.0/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.8.0/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.8.0/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.8.0/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.8.0/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.8.0/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.8.0/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/episodes/pom.xml b/basics/tags/0.8.0/tests/episodes/pom.xml deleted file mode 100644 index c533f831..00000000 --- a/basics/tags/0.8.0/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.0 - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.8.0/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.8.0/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/issues/.classpath b/basics/tags/0.8.0/tests/issues/.classpath deleted file mode 100644 index b936c996..00000000 --- a/basics/tags/0.8.0/tests/issues/.classpath +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/tests/issues/pom.xml b/basics/tags/0.8.0/tests/issues/pom.xml deleted file mode 100644 index 35d99c82..00000000 --- a/basics/tags/0.8.0/tests/issues/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.0 - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -Xequals-equalsStrategyClass=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB42EqualsStrategy - -XhashCode - -Xcopyable - -Xmergeable - -Xmergeable-mergeStrategyClass=org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy - -Xinheritance - -Xsetters - -Xsetters-mode=direct - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - -Xsimplify - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java deleted file mode 100644 index 77921c47..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { - - @Override - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { - // Quasi custom equals - return super.equals(leftLocator, rightLocator, lhs, rhs); - } else { - return super.equals(leftLocator, rightLocator, lhs, rhs); - } - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java b/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java deleted file mode 100644 index ff1fb59f..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB48Interface { - - public T getValue(); - -} diff --git a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java b/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java deleted file mode 100644 index 25d45a45..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB53ABaseClass { - -} diff --git a/basics/tags/0.8.0/tests/issues/src/main/resources/binding.xjb b/basics/tags/0.8.0/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 947ed1a4..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,18 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - diff --git a/basics/tags/0.8.0/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.8.0/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 64b983aa..00000000 --- a/basics/tags/0.8.0/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB48Interface<java.lang.String> - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53ABaseClass - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53AType - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java deleted file mode 100644 index 746bc3b7..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB20Test extends TestCase { - - public void testException() throws Exception { - - final List strings = Arrays.asList("a", "b", "c"); - final IssueJIIB20 one = new IssueJIIB20(); - one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); - - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java deleted file mode 100644 index 01ba2358..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB44Test extends TestCase { - - private JAXBContext context; - - @Override - protected void setUp() throws Exception { - context = JAXBContext.newInstance(getClass().getPackage().getName()); - } - - public void testReferencesPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_0.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testReferencesPropertyAsReferencePropertyType() - throws Exception { - - IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_1.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testElementsPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_2.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getString().size()); - Assert.assertEquals(3, value.getInt().size()); - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 2ea29226..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); -// args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xsetters-mode=direct"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); - args.add("-Xannotate"); - args.add("-Xsimplify"); - return args; - } - -} diff --git a/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml deleted file mode 100644 index 0915dfad..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml deleted file mode 100644 index b811fb9b..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml deleted file mode 100644 index 0008e3ee..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - a - b - 0 - c - 1 - 2 - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.8.0/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.8.0/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/one/.classpath b/basics/tags/0.8.0/tests/one/.classpath deleted file mode 100644 index 95482320..00000000 --- a/basics/tags/0.8.0/tests/one/.classpath +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/tests/one/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.0/tests/one/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 90d24a88..00000000 --- a/basics/tags/0.8.0/tests/one/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding//target/generated-sources/xjc=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.0/tests/one/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.0/tests/one/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.0/tests/one/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.0/tests/one/pom.xml b/basics/tags/0.8.0/tests/one/pom.xml deleted file mode 100644 index 3dc7a6f2..00000000 --- a/basics/tags/0.8.0/tests/one/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.0 - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.0/tests/one/src/main/resources/binding.xjb b/basics/tags/0.8.0/tests/one/src/main/resources/binding.xjb deleted file mode 100644 index 3888abb4..00000000 --- a/basics/tags/0.8.0/tests/one/src/main/resources/binding.xjb +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/tests/one/src/main/resources/schema.xsd b/basics/tags/0.8.0/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index e527b565..00000000 --- a/basics/tags/0.8.0/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.8.0/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.0/tests/one/src/test/resources/log4j.properties b/basics/tags/0.8.0/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.0/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/one/src/test/samples/1.xml b/basics/tags/0.8.0/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.0/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.0/tests/one/src/test/samples/2.xml b/basics/tags/0.8.0/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.8.0/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.8.0/tests/pom.xml b/basics/tags/0.8.0/tests/pom.xml deleted file mode 100644 index 4a37ee93..00000000 --- a/basics/tags/0.8.0/tests/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.0 - ../pom.xml - - - episodes - one - issues - zj - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - generate - - generate - - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/wildcard/.classpath b/basics/tags/0.8.0/tests/wildcard/.classpath deleted file mode 100644 index fc04c651..00000000 --- a/basics/tags/0.8.0/tests/wildcard/.classpath +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/tests/wildcard/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.0/tests/wildcard/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 04cfa2c1..00000000 --- a/basics/tags/0.8.0/tests/wildcard/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.0/tests/wildcard/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.0/tests/wildcard/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.0/tests/wildcard/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.0/tests/wildcard/src/main/resources/binding.xjb b/basics/tags/0.8.0/tests/wildcard/src/main/resources/binding.xjb deleted file mode 100644 index 8f780f74..00000000 --- a/basics/tags/0.8.0/tests/wildcard/src/main/resources/binding.xjb +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/basics/tags/0.8.0/tests/wildcard/src/main/resources/schema.xsd b/basics/tags/0.8.0/tests/wildcard/src/main/resources/schema.xsd deleted file mode 100644 index 7d520ce9..00000000 --- a/basics/tags/0.8.0/tests/wildcard/src/main/resources/schema.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/zj/pom.xml b/basics/tags/0.8.0/tests/zj/pom.xml deleted file mode 100644 index 833c62b0..00000000 --- a/basics/tags/0.8.0/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.0 - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.0/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.8.0/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.8.0/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.8.0/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.8.0/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.0/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.8.0/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.0/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.0/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.8.0/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.8.0/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.8.0/tools/.classpath b/basics/tags/0.8.0/tools/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.0/tools/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.0/tools/.project b/basics/tags/0.8.0/tools/.project deleted file mode 100644 index e7b0094b..00000000 --- a/basics/tags/0.8.0/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.0/tools/pom.xml b/basics/tags/0.8.0/tools/pom.xml deleted file mode 100644 index 5508efd9..00000000 --- a/basics/tags/0.8.0/tools/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - 0.8.0 - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.0 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - org.apache.commons - commons-lang3 - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index f67cc957..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!(namespaceURI== null || namespaceURI.length() == 0)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d3644156..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 176d5a2c..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,654 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(Outline outline, QName name) { - final CPluginCustomization customization = findCustomization(outline, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(Model model, QName name) { - final CPluginCustomization customization = findCustomization(model, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(EnumOutline enumOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - enumOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - Outline outline, QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CEnumLeafInfo enumLeafInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - enumLeafInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Outline outline, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(outline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Outline outline) { - return getCustomizations(outline.getModel()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index c65295d2..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public boolean isAlwaysSet() { - if (constantField != null) { - return true; - } else { - return JExpr.TRUE == fieldAccessor.hasSetValue(); - } - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - if (isAlwaysSet()) { - block.assign($var, targetObject.invoke(getter)); - } else { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index cb6e5928..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(final MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = classInfo - .getBaseTypeInfo() - .acceptClassTypeInfoVisitor( - new MClassTypeInfoVisitor() { - @Override - public MClassOutline visitClassInfo( - MClassInfo info) { - return parent.getParent().getClassOutline( - info); - } - - @Override - public MClassOutline visitClassRef( - MClassRef info) { - return null; - } - }); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 15e216be..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 8178879e..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 0e5b4ec1..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index bb384e2f..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(final CMModelOutline modelOutline, - final MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - classInfo.getBaseTypeInfo().acceptClassTypeInfoVisitor( - new MClassTypeInfoVisitor() { - @Override - public Void visitClassInfo( - MClassInfo info) { - generateClassOutline(modelOutline, modelInfo, info); - return null; - } - - @Override - public Void visitClassRef(MClassRef info) { - return null; - } - }); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index b045735f..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index 344bc3f7..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 656f8d82..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,394 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - private final Map> classRefs = - - new IdentityHashMap>(); - - public XJCCMInfoFactory(Model model) { - super(model); - } - - protected NClass getClazz(CClassRef info) { - return info; - } - - protected NClass getClazz(final Class _clas) { - return new NClass() { - - @Override - public boolean isBoxedType() { - return false; - } - - @Override - public String fullName() { - return _clas.getName(); - } - - @Override - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(_clas); - } - - @Override - public boolean isAbstract() { - return false; - } - }; - } - - protected NClass getClazz(final String className) { - return new NClass() { - - @Override - public boolean isBoxedType() { - return false; - } - - @Override - public String fullName() { - return className; - } - - @Override - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(className); - } - - @Override - public boolean isAbstract() { - return false; - } - }; - } - - protected MClassRef createClassRef(Class _class) { - return new CMClassRef(getClazz(_class), - getPackage(_class), getContainer(_class), getLocalName(_class)); - } - - protected MClassRef getTypeInfo(CClassRef info) { - - MClassRef classInfo = classRefs.get(info); - - if (classInfo == null) { - - classInfo = createClassRef(info); - classRefs.put(info, classInfo); - } - return classInfo; - } - - protected MClassRef createClassRef(CClassRef info) { - return new CMClassRef(getClazz(info), getPackage(info), - getContainer(info), getLocalName(info)); - } - - @Override - protected MTypeInfo getTypeInfo(CTypeInfo typeInfo) { - if (typeInfo instanceof CClassRef) { - return getTypeInfo((CClassRef) typeInfo); - } else { - return super.getTypeInfo(typeInfo); - } - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - protected MPackageInfo getPackage(CClassRef info) { - final String fullName = info.fullName(); - return getPackage(fullName); - } - - private MPackageInfo getPackage(final String fullName) { - try { - final Class _class = Class.forName(fullName); - return getPackage(_class); - } catch (ClassNotFoundException cnfex) { - final String packageName; - final int lastIndexOfDot = fullName.lastIndexOf('.'); - if (lastIndexOfDot != -1) { - packageName = fullName.substring(0, lastIndexOfDot); - } else { - packageName = ""; - } - return new CMPackageInfo(new CMPackageInfoOrigin(), packageName); - } - } - - private MPackageInfo getPackage(final Class _class) { - final Package _package = _class.getPackage(); - return new CMPackageInfo(new CMPackageInfoOrigin(), _package.getName()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - @Override - protected MContainer getContainer(CClassInfo info) { - final CClassInfoParent parent = info.parent(); - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CElementInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CEnumLeafInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - protected MContainer getContainer(CClassRef info) { - final String fullName = info.fullName(); - try { - final Class _class = Class.forName(fullName); - return getContainer(_class); - } catch (ClassNotFoundException cnfex) { - return getPackage(info); - } - } - - private MContainer getContainer(final Class _class) { - final Class enclosingClass = _class.getEnclosingClass(); - if (enclosingClass == null) { - return getPackage(_class); - } else { - return createClassRef(enclosingClass); - } - } - - private final Map packages = new HashMap(); - - private MContainer getContainer(CClassInfoParent parent) { - return parent.accept(new Visitor() { - - public MContainer onBean(CClassInfo bean) { - return getTypeInfo(bean); - } - - public MContainer onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MContainer onElement(CElementInfo element) { - return getElementInfo(element); - } - }); - } - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected MClassInfo getScope(CClassInfo info) { - return info.getScope() == null ? null : getTypeInfo(info.getScope()); - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - protected String getLocalName(CClassRef info) { - final String fullName = info.fullName(); - try { - final Class _class = Class.forName(fullName); - return getLocalName(_class); - } catch (ClassNotFoundException cnfex) { - return getLocalName(fullName); - } - } - - private String getLocalName(final String fullName) { - final int lastIndexOfDollar = fullName.lastIndexOf('$'); - if (lastIndexOfDollar != -1) { - return fullName.substring(lastIndexOfDollar + 1); - } - final int lastIndexOfDot = fullName.lastIndexOf('.'); - if (lastIndexOfDot != -1) { - return fullName.substring(lastIndexOfDot + 1); - } - return fullName; - } - - private String getLocalName(final Class _class) { - return _class.getSimpleName(); - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CElementInfo info) { - return info.shortName(); - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } - - private MPackageInfo getPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - @Override - protected MClassTypeInfo createBaseTypeInfo(CClassInfo info) { - if (info.getBaseClass() != null) { - return getTypeInfo(info.getBaseClass()); - } else if (info.getRefBaseClass() != null) { - return getTypeInfo(info.getRefBaseClass()); - } else { - return null; - } - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 28ed69a4..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index 51ee09b5..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); - - public boolean isAlwaysSet(); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index e977655d..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 033acf34..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 369c9768..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index d89918aa..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 11444b09..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index 96e82667..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index 85bd7b16..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index 67a576c1..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 41c9d885..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 74b7bd87..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index be5334e4..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index f4f9e307..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c8b7f118..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 91362018..00000000 --- a/basics/tags/0.8.0/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/tags/0.8.1/ant/.classpath b/basics/tags/0.8.1/ant/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.1/ant/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/ant/.project b/basics/tags/0.8.1/ant/.project deleted file mode 100644 index 63b92b0b..00000000 --- a/basics/tags/0.8.1/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.1/ant/pom.xml b/basics/tags/0.8.1/ant/pom.xml deleted file mode 100644 index 698569ee..00000000 --- a/basics/tags/0.8.1/ant/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.1 - ../pom.xml - - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.1/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.8.1/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.8.1/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.8.1/basic/.classpath b/basics/tags/0.8.1/basic/.classpath deleted file mode 100644 index 5d675fc8..00000000 --- a/basics/tags/0.8.1/basic/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/basic/.project b/basics/tags/0.8.1/basic/.project deleted file mode 100644 index 9ef5e932..00000000 --- a/basics/tags/0.8.1/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.1/basic/pom.xml b/basics/tags/0.8.1/basic/pom.xml deleted file mode 100644 index 786a20c4..00000000 --- a/basics/tags/0.8.1/basic/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.8.1 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.1 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - com.google.code.javaparser - javaparser - 1.0.8 - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.felix - - - maven-bundle-plugin - - - [2.3.7,) - - - manifest - - - - - - - - - - org.jvnet.jaxb2.maven2 - - - maven-jaxb2-plugin - - - [0.8.1,) - - - generate - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 176f243b..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(EnumOutline enumOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 0d007353..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(EnumOutline enumOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index ca56dce8..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,335 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String copyStrategyClass = JAXBCopyStrategy.class.getName(); - - public void setCopyStrategyClass(final String copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public String getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, - codeModel.ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, - codeModel.ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl( - JMod.FINAL, - theClass.owner().ref(Object.class), - "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), - JExpr.invoke("createNewInstance"), target)); - } else { - body._if(JExpr._null().eq(target)) - ._then() - ._throw(JExpr - ._new(theClass.owner().ref( - IllegalArgumentException.class)) - .arg("Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator) - .arg(draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", - JExpr.cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (!sourceFieldAccessor.isAlwaysSet() - && valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr - .invoke(copyStrategy, "copy") - .arg(theClass - .owner() - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), - copyFieldType.isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java deleted file mode 100644 index 0b550431..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/enumvalue"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java deleted file mode 100644 index 177a950c..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.EnumValue; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EnumValuePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XenumValue"; - } - - @Override - public String getUsage() { - return "Forces generated @XmlEnums implement the org.jvnet.jaxb2_commons.lang.EnumValue interface."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final EnumOutline enumOutline : outline.getEnums()) { - if (!getIgnoring().isIgnored(enumOutline)) { - processEnumOutline(enumOutline); - } - } - return true; - } - - protected void processEnumOutline(EnumOutline enumOutline) { - CEnumLeafInfo enumLeafInfo = enumOutline.target; - JClass enumType = enumLeafInfo.base.toType(enumOutline.parent(), - Aspect.EXPOSED).boxify(); - - final JDefinedClass theClass = enumOutline.clazz; - - ClassUtils._implements(theClass, theClass.owner().ref(EnumValue.class) - .narrow(enumType)); - - final JMethod enumValue$enumValue = theClass.method(JMod.PUBLIC, - enumType, "enumValue"); - enumValue$enumValue.body()._return(JExpr._this().invoke("value")); - } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 5d35be2b..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); - - public void setEqualsStrategyClass(String equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public String getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - // - // @SuppressWarnings("unused") - // final JMethod equals$equals = generateEquals$equals(enumOutline, - // theClass); - // } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } - - // protected JMethod generateEquals$equals(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // final JCodeModel codeModel = theClass.owner(); - // final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - // "equals"); - // - // { - // final JBlock body = equals.body(); - // final JVar leftLocator = equals.param(ObjectLocator.class, - // "thisLocator"); - // final JVar rightLocator = equals.param(ObjectLocator.class, - // "thatLocator"); - // final JVar object = equals.param(Object.class, "object"); - // final JVar equalsStrategy = equals.param(EqualsStrategy.class, - // "strategy"); - // - // body._return(equalsStrategy - // .invoke("equals") - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(leftLocator) - // .arg("value").arg(JExpr._this().ref("value"))) - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(rightLocator) - // .arg("value").arg(object.ref("value"))) - // .arg(JExpr._this().ref("value")).arg(object.ref("value"))); - // - // } - // return equals; - // } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index 571b6fbe..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); - - public void setHashCodeStrategyClass(String hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public String getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - // - // // @SuppressWarnings("unused") - // // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode = generateHashCode$hashCode( - // enumOutline, theClass); - // // @SuppressWarnings("unused") - // // final JMethod object$hashCode = generateObject$hashCode(enumOutline, - // // theClass); - // } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - return generateObject$hashCode(theClass); - } - - // protected JMethod generateObject$hashCode(final EnumOutline enumOutline, - // final JDefinedClass theClass) { - // return generateObject$hashCode(theClass); - // } - - private JMethod generateObject$hashCode(final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, - theClass.owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass - .owner().ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl( - fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign( - currentHashCode, - hashCodeStrategy - .invoke("hashCode") - .arg(codeModel - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(theValue)) - .arg(currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } - - // protected JMethod generateHashCode$hashCode(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // JCodeModel codeModel = theClass.owner(); - // final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - // codeModel.INT, "hashCode"); - // final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - // "locator"); - // final JVar hashCodeStrategy = hashCode$hashCode.param( - // HashCodeStrategy.class, "strategy"); - // final JBlock body = hashCode$hashCode.body(); - // - // body._return(hashCodeStrategy - // .invoke("hashCode") - // .arg(codeModel.ref(LocatorUtils.class).staticInvoke("property") - // .arg(locator).arg("value") - // .arg(JExpr._this().ref("value"))).arg(JExpr.lit(1)) - // .arg(JExpr._this().ref("value"))); - // - // return hashCode$hashCode; - // } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index 0d8c96ec..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIEnum; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - final Map knownClasses = new HashMap(); - final Map knownClassInfos = new IdentityHashMap(); - - for (final ClassOutline classOutline : outline.getClasses()) { - knownClasses.put(classOutline.implClass.fullName(), - classOutline.implClass); - knownClassInfos.put(classOutline.implClass, classOutline.target); - } - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, knownClasses, knownClassInfos); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, knownClasses); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, knownClasses); - } - } - processPackageOutlines(outline, knownClasses); - return true; - } - - private void processClassOutline(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - - generateExtends(classOutline, knownClasses, knownClassInfos); - generateImplements(classOutline, knownClasses); - - } - - private void processEnumOutline(EnumOutline enumOutline, - Map knownClasses) { - - generateExtends(enumOutline, knownClasses); - generateImplements(enumOutline, knownClasses); - - } - - private void processElementOutline(ElementOutline elementOutline, - Map knownClasses) { - - generateExtends(elementOutline, knownClasses); - generateImplements(elementOutline, knownClasses); - - } - - private void processPackageOutlines(Outline outline, - Map knownClasses) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass, - knownClasses); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface, knownClasses); - } - } - } - } - } - } - } - } - - private JClass generateExtends(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - JClass targetClass = generateExtends(theClass, - extendsClassCustomization, knownClasses); - - final CClassInfo classInfo = classOutline.target; - if (targetClass != null && classInfo.getBaseClass() == null - && classInfo.getRefBaseClass() == null) { - final CClassInfo targetClassInfo = knownClassInfos.get(targetClass); - if (targetClassInfo == null && classInfo.getRefBaseClass() == null) { - final Model model = classInfo.model; - // BIEnum as BIClass is protected too much - final BIEnum decl = new BIEnum(); - decl.ref = targetClass.fullName(); - final CClassRef baseClass = new CClassRef(model, - classInfo.getSchemaComponent(), decl, - new CCustomizations()); - classInfo.setBaseClass(baseClass); - } else if (targetClassInfo != null - && classInfo.getBaseClass() == null) { - classInfo.setBaseClass(targetClassInfo); - } - } - return targetClass; - } - - private JClass generateExtends(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization, - Map knownClasses) throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - return generateExtends(theClass, extendsClass, knownClasses); - } else { - return null; - } - } - - private JClass generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass, Map knownClasses) { - if (extendsClass.getClassName() != null) { - final String _class = extendsClass.getClassName(); - final JClass targetClass = parseClass(_class, theClass.owner(), - knownClasses); - theClass._extends(targetClass); - return targetClass; - } else { - return null; - } - } - - private List generateImplements(ClassOutline classOutline, - Map knownClasses) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations, - Map knownClasses) throws AssertionError { - final List implementedInterfaces = new ArrayList( - implementsInterfaceCustomizations.size()); - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - - final JClass implementedInterface = generateImplements( - theClass, implementsInterface, knownClasses); - if (implementedInterface != null) { - implementedInterfaces.add(implementedInterface); - } - } - } - return implementedInterfaces; - } - - private JClass generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface, - Map knownClasses) { - - String _interface = implementsInterface.getInterfaceName(); - if (_interface != null) { - final JClass targetClass = parseClass(_interface, theClass.owner(), - knownClasses); - theClass._implements(targetClass); - return targetClass; - } else { - return null; - } - } - - private JClass parseClass(String _class, JCodeModel codeModel, - Map knownClasses) { - return new JavaTypeParser(knownClasses).parseClass(_class, codeModel); - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java deleted file mode 100644 index 5fa73bc2..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.JavaParser; -import japa.parser.ParseException; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class JavaTypeParser { - - static { - JavaParser.setCacheParser(false); - } - - private final TypeToJTypeConvertingVisitor typeToJTypeConvertingVisitor; - - public JavaTypeParser() { - this(Collections. emptyMap()); - } - - public JavaTypeParser(Map knownClasses) { - Validate.notNull(knownClasses); - this.typeToJTypeConvertingVisitor = new TypeToJTypeConvertingVisitor( - knownClasses); - - } - - public JClass parseClass(String _class, JCodeModel codeModel) { - JType type = parseType(_class, codeModel); - if (type instanceof JClass) { - return (JClass) type; - } else { - throw new IllegalArgumentException("Type [" + _class - + "] is not a class."); - } - } - - private JType parseType(String type, JCodeModel codeModel) { - final String text = "public class Ignored extends " + type + " {}"; - try { - CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - final List _extended = classDeclaration - .getExtends(); - final ClassOrInterfaceType classOrInterfaceType = _extended.get(0); - - return classOrInterfaceType.accept( - this.typeToJTypeConvertingVisitor, codeModel); - } catch (ParseException pex) { - throw new IllegalArgumentException( - "Could not parse the type definition [" + type + "].", pex); - } catch (UnsupportedEncodingException uex) { - throw new UnsupportedOperationException(uex); - } - } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java deleted file mode 100644 index 021d97b3..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; -import japa.parser.ast.visitor.GenericVisitorAdapter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class TypeToJTypeConvertingVisitor extends - GenericVisitorAdapter { - - private final Map knownClasses; - - public TypeToJTypeConvertingVisitor(Map knownClasses) { - Validate.notNull(knownClasses); - this.knownClasses = knownClasses; - } - - @Override - public JType visit(VoidType type, JCodeModel codeModel) { - return codeModel.VOID; - } - - @Override - public JType visit(PrimitiveType type, JCodeModel codeModel) { - switch (type.getType()) { - case Boolean: - return codeModel.BOOLEAN; - case Char: - return codeModel.CHAR; - case Byte: - return codeModel.BYTE; - case Short: - return codeModel.SHORT; - case Int: - return codeModel.INT; - case Long: - return codeModel.LONG; - case Float: - return codeModel.FLOAT; - case Double: - return codeModel.DOUBLE; - default: - throw new AssertionError("Unknown primitive type [" - + type.getType() + "]"); - } - } - - @Override - public JType visit(ReferenceType type, JCodeModel codeModel) { - final JType referencedType = type.getType().accept(this, codeModel); - - JType referencedTypeArray = referencedType; - for (int index = 0; index < type.getArrayCount(); index++) { - referencedTypeArray = referencedTypeArray.array(); - } - return referencedTypeArray; - } - - @Override - public JType visit(WildcardType type, JCodeModel codeModel) { - - if (type.getExtends() != null) { - final ReferenceType _extends = type.getExtends(); - final JType boundType = _extends.accept(this, codeModel); - - if (!(boundType instanceof JClass)) { - throw new IllegalArgumentException("Bound type [" + _extends - + "]in the wildcard type must be class."); - } - - final JClass boundClass = (JClass) boundType; - return boundClass.wildcard(); - } else if (type.getSuper() != null) { - // TODO - throw new IllegalArgumentException( - "Wildcard types with super clause are not supported at the moment."); - } else { - throw new IllegalArgumentException( - "Wildcard type must have either extends or super clause."); - } - } - - @Override - public JType visit(ClassOrInterfaceType type, JCodeModel codeModel) { - final String name = getName(type); - final JClass knownClass = this.knownClasses.get(name); - final JClass jclass = knownClass != null ? knownClass : codeModel - .ref(name); - final List typeArgs = type.getTypeArgs(); - if (typeArgs == null || typeArgs.isEmpty()) { - return jclass; - } else { - final List jtypeArgs = new ArrayList( - typeArgs.size()); - for (Type typeArg : typeArgs) { - final JType jtype = typeArg.accept(this, codeModel); - if (!(jtype instanceof JClass)) { - throw new IllegalArgumentException("Type argument [" - + typeArg.toString() + "] is not a class."); - } else { - jtypeArgs.add((JClass) jtype); - } - } - return jclass.narrow(jtypeArgs); - } - } - - private String getName(ClassOrInterfaceType type) { - final String name = type.getName(); - final ClassOrInterfaceType scope = type.getScope(); - if (scope == null) { - return name; - } else { - return getName(scope) + "." + name; - } - } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index c83e1901..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); - - public void setMergeStrategyClass( - final String mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public String getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index fbc662d6..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - public static enum Mode { - - accessor { - - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(setter.body()); - accessor.fromRawValue(setter.body(), "draft", value); - } - }, - direct { - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - - final JFieldVar field = theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - - if (field != null) { - setter.body().assign(JExpr._this().ref(field), value); - } else { - // Fallback to the accessor - Mode.accessor.generateSetter(fieldOutline, theClass, - setter, value); - } - } - }; - public abstract void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value); - } - - private Mode mode = Mode.accessor; - - public String getMode() { - return mode.name(); - - } - - public void setMode(String mode) { - Validate.notNull(mode); - try { - this.mode = Mode.valueOf(mode); - } catch (IllegalArgumentException iaex) { - throw new IllegalArgumentException( - "Unsupported mode [" - + mode - + "]." - + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" - + " and [direct] (assigns the value to the field directly)."); - } - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - - mode.generateSetter(fieldOutline, theClass, - generatedSetter, value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java deleted file mode 100644 index 783cf37b..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - - public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-element-property"); - - public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-reference-property"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java deleted file mode 100644 index 97de9dd7..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeRef; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.ID; - -public class SimplifyPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xsimplify"; - } - - @Override - public String getUsage() { - return "This plugin allows simplifying \"complex\" properties" - + " (ex. aOrBOrC generated from repeatable choices)" - + " into several \"simple\" properties (ex. a, b, c).\n" - + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" - + " for plugin documentation."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public void postProcessModel(final Model model, ErrorHandler errorHandler) { - - for (final CClassInfo classInfo : model.beans().values()) { - postProcessClassInfo(model, classInfo); - } - } - - private void postProcessClassInfo(final Model model, - final CClassInfo classInfo) { - final List properties = new ArrayList( - classInfo.getProperties()); - for (CPropertyInfo property : properties) { - property.accept(new CPropertyVisitor() { - - public Void onElement(CElementPropertyInfo elementProperty) { - postProcessElementPropertyInfo(model, classInfo, - elementProperty); - return null; - } - - public Void onAttribute(CAttributePropertyInfo attributeProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onValue(CValuePropertyInfo valueProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onReference(CReferencePropertyInfo p) { - postProcessReferencePropertyInfo(model, classInfo, p); - return null; - } - - }); - } - } - - private void postProcessElementPropertyInfo(final Model model, - final CClassInfo classInfo, CElementPropertyInfo property) { - if (property.isCollection() && property.getTypes().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyElementPropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } - } - } - - private void postProcessReferencePropertyInfo(final Model model, - final CClassInfo classInfo, CReferencePropertyInfo property) { - if (property.isCollection() && property.getElements().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } else if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsReferencePropertyInfo(model, - classInfo, property); - } - } - } - - private void simplifyElementPropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CElementPropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CTypeRef typeRef : property.getTypes()) { - final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( - model, property, typeRef); - classInfo.getProperties().add(index++, elementPropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsReferencePropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( - model, property, element); - classInfo.getProperties().add(index++, referencePropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CElementPropertyInfo elementPropertyInfo; - if (element instanceof CElementInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CElementInfo) element); - } else if (element instanceof CClassInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CClassInfo) element); - - } else if (element instanceof CClassRef) { - // elementPropertyInfo = createElementPropertyInfo(model, - // element, - // (CClassRef) element); - elementPropertyInfo = null; - // TODO WARN - - } else { - // TODO WARN - elementPropertyInfo = null; - } - if (elementPropertyInfo != null) { - classInfo.getProperties().add(index++, elementPropertyInfo); - } - } - classInfo.getProperties().remove(property); - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CElementInfo elementInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(elementInfo.getContentType(), element - .getElementName(), elementInfo.getContentType() - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CClassInfo classInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(classInfo, element.getElementName(), classInfo - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - // private CElementPropertyInfo createElementPropertyInfo(final Model model, - // CElement element, final CClassRef cr) { - // final CElementPropertyInfo elementPropertyInfo; - // final String propertyName = createPropertyName(model, element); - // elementPropertyInfo = new CElementPropertyInfo(propertyName, - // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - // element.getSchemaComponent(), element.getCustomizations(), - // element.getLocator(), false); - // elementPropertyInfo.getTypes().add( - // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), - // false, null)); - // return elementPropertyInfo; - // } - - private CReferencePropertyInfo createReferencePropertyInfo( - final Model model, CReferencePropertyInfo property, CElement element) { - final String propertyName = createPropertyName(model, element); - final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( - propertyName, true, false, property.isMixed(), - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), property.isDummy(), property.isContent(), - property.isMixedExtendedCust()); - referencePropertyInfo.getElements().add(element); - return referencePropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElementPropertyInfo property, CTypeRef typeRef) { - final String propertyName = createPropertyName(model, typeRef); - boolean required = false; - final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( - propertyName, CollectionMode.REPEATED_ELEMENT, typeRef - .getTarget().idUse(), typeRef.getTarget() - .getExpectedMimeType(), property.getSchemaComponent(), - property.getCustomizations(), property.getLocator(), required); - elementPropertyInfo.getTypes().add(typeRef); - return elementPropertyInfo; - } - - private String createPropertyName(final Model model, CElement element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getElementName().getLocalPart()); - return propertyName; - } - - private String createPropertyName(final Model model, CTypeRef element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getTagName().getLocalPart()); - return propertyName; - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index dc8eac3c..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); - - public void setToStringStrategyClass( - String toStringStrategy) { - this.toStringStrategyClass = toStringStrategy; - } - - public String getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 6f95d0b1..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final String strategyClassName) { - - try { - final Class strategyClass = Class.forName(strategyClassName); - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } catch (ClassNotFoundException cnfex) { - final JClass strategyJClass = codeModel.ref(strategyClassName); - return JExpr._new(strategyJClass); - } - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index b44a1cb3..00000000 --- a/basics/tags/0.8.1/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - final boolean laxModel = CustomizationUtils.containsCustomization( - model, Customizations.LAX_ELEMENT_NAME); - final boolean skipModel = CustomizationUtils.containsCustomization( - model, Customizations.SKIP_ELEMENT_NAME); - final boolean strictModel = CustomizationUtils.containsCustomization( - model, Customizations.STRICT_ELEMENT_NAME); - for (CClassInfo classInfo : model.beans().values()) { - final boolean laxClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.STRICT_ELEMENT_NAME); - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - final boolean laxPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME); - - if (laxModel) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipModel) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictModel) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.8.1/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.8.1/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 99ef7147..00000000 --- a/basics/tags/0.8.1/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,13 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin -org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin -org.jvnet.jaxb2_commons.plugin.enumvalue.EnumValuePlugin \ No newline at end of file diff --git a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java b/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java deleted file mode 100644 index 30bdf587..00000000 --- a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; - -public class JavaParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final JavaTypeParser javaTypeParser = new JavaTypeParser(); - final JCodeModel codeModel = new JCodeModel(); - JClass comparator = javaTypeParser.parseClass("java.util.Comparator", - codeModel); - assertNotNull(comparator); - JClass integerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(integerComparator); - JClass wildcardIntegerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(wildcardIntegerComparator); - } -} diff --git a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java b/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java deleted file mode 100644 index a2562048..00000000 --- a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; - -import java.io.ByteArrayInputStream; -import java.util.List; - -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - assertEquals(1, typeDeclarations.size()); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - assertEquals("Dummy", classDeclaration.getName()); - final List implementedInterfaces = classDeclaration - .getImplements(); - assertEquals(1, implementedInterfaces.size()); - final ClassOrInterfaceType implementedInterface = implementedInterfaces - .get(0); - assertEquals("Comparator", implementedInterface.getName()); - final List typeArgs = implementedInterface.getTypeArgs(); - assertEquals(1, typeArgs.size()); - final Type typeArg = typeArgs.get(0); - assertTrue(typeArg instanceof ReferenceType); - final ReferenceType referenceTypeArg = (ReferenceType) typeArg; - final Type referencedType = referenceTypeArg.getType(); - assertTrue(referencedType instanceof ClassOrInterfaceType); - final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; - assertEquals("Integer", typeArgType.getName()); - - } -} diff --git a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.8.1/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.8.1/basic/src/test/resources/schema.xsd b/basics/tags/0.8.1/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.8.1/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/build-1.6.bat b/basics/tags/0.8.1/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.8.1/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.1/deploy.bat b/basics/tags/0.8.1/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/tags/0.8.1/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/tags/0.8.1/dist/pom.xml b/basics/tags/0.8.1/dist/pom.xml deleted file mode 100644 index f718d365..00000000 --- a/basics/tags/0.8.1/dist/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.1 - ../pom.xml - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/dist - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - diff --git a/basics/tags/0.8.1/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.8.1/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.8.1/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.8.1/dist/src/main/assembly/dist.xml b/basics/tags/0.8.1/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.8.1/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.8.1/install-1.6.bat b/basics/tags/0.8.1/install-1.6.bat deleted file mode 100644 index 57a75b67..00000000 --- a/basics/tags/0.8.1/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -Psamples,tests,dist clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.1/install.bat b/basics/tags/0.8.1/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/tags/0.8.1/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/tags/0.8.1/jaxb/pom.xml b/basics/tags/0.8.1/jaxb/pom.xml deleted file mode 100644 index 2ad49ae7..00000000 --- a/basics/tags/0.8.1/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 7 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/jaxb/release.bat b/basics/tags/0.8.1/jaxb/release.bat deleted file mode 100644 index e6784200..00000000 --- a/basics/tags/0.8.1/jaxb/release.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn clean deploy -DperformRelease=true -Psonatype-oss-release \ No newline at end of file diff --git a/basics/tags/0.8.1/jaxb/xjc/pom.xml b/basics/tags/0.8.1/jaxb/xjc/pom.xml deleted file mode 100644 index a2a60692..00000000 --- a/basics/tags/0.8.1/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.4 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/pom.xml b/basics/tags/0.8.1/pom.xml deleted file mode 100644 index a6172d78..00000000 --- a/basics/tags/0.8.1/pom.xml +++ /dev/null @@ -1,334 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.8.1 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/trunk - - - ant - runtime - tools - testing - basic - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - dist - - - dist - - - - dist - - - - - 2.2.5-2 - 0.8.2 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb.version} - - - - junit - junit - 3.8.1 - - - - org.apache.commons - commons-lang3 - 3.2.1 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.6 - 1.6 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.8.1/release.bat b/basics/tags/0.8.1/release.bat deleted file mode 100644 index ca58cfd7..00000000 --- a/basics/tags/0.8.1/release.bat +++ /dev/null @@ -1,76 +0,0 @@ -setlocal -echo Setting JAVA_HOME to %JAVA6_HOME%. -set JAVA_HOME=%JAVA6_HOME% - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -DperformRelease -Psamples,tests,dist -echo Full clean build completed. -pause - -echo Setting new version to %1. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 -echo Version was set to %1. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %1 committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -Psamples,tests,dist -DperformRelease -echo Full clean build completed. -pause - -echo Checking in version %1. -pause -call mvn scm:checkin -Dmessage="Version %1" -echo Version %1 was checked in. -pause - -echo Tagging version %1. -pause -call mvn scm:tag -Dtag=%1 -echo Version %1 was tagged. -pause - -echo Performing full clean deploy. -pause -call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy -echo Full clean deploy done. -pause - -echo Setting new version to %2. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 -echo Version was set to %2. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %2 was committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -pause - -echo Checking in version %2. -pause -call mvn scm:checkin -Dmessage="Version %2" -echo Version %2 was checked in. -pause - -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.1/runtime/.classpath b/basics/tags/0.8.1/runtime/.classpath deleted file mode 100644 index 5d675fc8..00000000 --- a/basics/tags/0.8.1/runtime/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/runtime/.project b/basics/tags/0.8.1/runtime/.project deleted file mode 100644 index 5441da06..00000000 --- a/basics/tags/0.8.1/runtime/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.1/runtime/pom.xml b/basics/tags/0.8.1/runtime/pom.xml deleted file mode 100644 index 2090e545..00000000 --- a/basics/tags/0.8.1/runtime/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - 0.8.1 - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.1 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - - - bundle-manifest - process-classes - - manifest - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index d66a74b7..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,371 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else if (lhs instanceof Equals[]) { - return equalsInternal(leftLocator, rightLocator, (Equals[]) lhs, - (Equals[]) rhs); - } else if (lhs instanceof Enum[]) { - return equalsInternal(leftLocator, rightLocator, (Enum[]) lhs, - (Enum[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else if (lhs instanceof Enum) { - return equalsInternal(leftLocator, rightLocator, (Enum) lhs, (Enum) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum lhs, Enum rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals lhs, Equals rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - return lhs.equals(leftLocator, rightLocator, rhs, this); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals[] left, Equals[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum[] left, Enum[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index e54659cd..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else if (object instanceof HashCode[]) { - return hashCodeInternal(locator, hashCode, (HashCode[]) object); - } else if (object instanceof Enum[]) { - return hashCodeInternal(locator, hashCode, (Enum[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else if (value instanceof Enum) { - return hashCodeInternal(locator, hashCode, (Enum) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode object) { - if (object == null) { - return hashCode * iConstant; - } else { - return hashCode * iConstant + object.hashCode(locator, this); - } - } - - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java deleted file mode 100644 index 9e843b88..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public interface EnumValue { - - public T enumValue(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index a6c06704..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 88b3cce7..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - // Treat empty lists as nulls - if (list.isEmpty()) { - return super.hashCode(locator, hashCode, (Object) null); - } else { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 8407ab35..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - public String getPathAsString() { - final String stepAsString = getStepAsString(); - final ObjectLocator parentLocator = getParentLocator(); - return parentLocator == null ? stepAsString : parentLocator - .getPathAsString() + stepAsString; - } - - protected abstract String getStepAsString(); - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - - // public Object[] getMessageParameters() { - // return new Object[] { getObject() }; - // } - // - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() + ".messages")); - } - - // public int hashCode() { - // int hashCode = getObject().hashCode(); - // return hashCode; - // } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index ce0d32ff..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "[" + getIndex() + "]"; - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index 0484223a..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "." + getPropertyName(); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index ecd6fc3e..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return ""; - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 37aa8555..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * @return Path to this locator in string form; - */ - public String getPathAsString(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index 57cecb8e..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MClassTypeInfo, - MOriginated { - - public MClassTypeInfo getBaseTypeInfo(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java deleted file mode 100644 index 963d4734..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassRef extends MClassTypeInfo { -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java deleted file mode 100644 index fb396a97..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassTypeInfo extends MPackagedTypeInfo, - MContainer { - - public C getTargetClass(); - - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java deleted file mode 100644 index 47d7b23e..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassTypeInfoVisitor { - - public V visitClassInfo(MClassInfo info); - - public V visitClassRef(MClassRef info); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java deleted file mode 100644 index 73f92248..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContained { - - public MContainer getContainer(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java deleted file mode 100644 index e55cac10..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContainer extends MPackaged { - - public String getLocalName(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java deleted file mode 100644 index 1a673485..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomizable { - - public MCustomizations getCustomizations(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java deleted file mode 100644 index 3e32cc52..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomization { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java deleted file mode 100644 index b20537dc..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MCustomizations { - - public List getCustomizations(); - - public void addCustomization(MCustomization customization); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index 6c72d310..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated, MContained, MContainer { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java deleted file mode 100644 index 4a43b435..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MID extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java deleted file mode 100644 index 49ca1c30..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREF extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java deleted file mode 100644 index 1f0b2084..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREFS extends MList { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 9e0b5b8c..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MCustomizable, - MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 6ea7fe61..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated, - MContainer { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 7c7571b9..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged, - MContained { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index 0d628be5..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitID(MID info) { - return null; - } - - public V visitIDREF(MIDREF info) { - return null; - } - - public V visitIDREFS(MIDREFS info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 98a86bc7..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo extends MCustomizable { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 8b2d1e4b..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor extends - MClassTypeInfoVisitor { - - public V visitList(MList info); - - public V visitID(MID info); - - public V visitIDREF(MIDREF info); - - public V visitIDREFS(MIDREFS info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 6dd77b37..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - private final MCustomizations customizations = new CMCustomizations(); - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index bdc4a89a..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - private final MClassTypeInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MClassTypeInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getContainer(), getLocalName(), - getElementName(), scope, this, substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MContainer getScope() { - return container; - } - - public MClassTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } - - @Override - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java deleted file mode 100644 index a64ba452..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMClassRef implements MClassRef { - - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - - public CMClassRef(/* MClassInfoOrigin origin, */C targetClass, - MPackageInfo _package, MContainer container, String localName) { - super(); - // Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - // this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public T getTargetType() { - return targetClass; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassRef(this); - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public C getTargetClass() { - return targetClass; - } - - @Override - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor) { - return visitor.visitClassRef(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java deleted file mode 100644 index 6e09ab64..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.w3c.dom.Element; - -public class CMCustomization implements MCustomization { - - private final Element element; - - public CMCustomization(Element element) { - this.element = element; - } - - public Element getElement() { - return element; - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java deleted file mode 100644 index c7bfa857..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; - -public class CMCustomizations implements MCustomizations { - - private final List customizations = new LinkedList(); - private final List unmodifiableCustomizations = Collections - .unmodifiableList(this.customizations); - - public List getCustomizations() { - return unmodifiableCustomizations; - } - - public void addCustomization(MCustomization customization) { - Validate.notNull(customization); - this.customizations.add(customization); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index e539fd75..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final MContainer container; - - private final String localName; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - MContainer container, String localName, QName elementName, - MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.container = container; - this.localName = localName; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getLocalName() { - return localName; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index aa7c8693..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); -// Validate.notEmpty(elementTypeInfos); -// Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 47a598a2..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo, - MCustomizable { - - private final MEnumLeafInfoOrigin origin; - private final CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final MContainer container; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.container = container; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), - getContainer(), - getLocalName(), - getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java deleted file mode 100644 index 5daa634c..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMID implements MID { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMID(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitID(this); - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java deleted file mode 100644 index 2eaeacde..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMIDREF implements MIDREF { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMIDREF(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREF(this); - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java deleted file mode 100644 index accf9d52..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMIDREFS extends CMList implements MIDREFS { - - public CMIDREFS(T targetType, MTypeInfo itemTypeInfo) { - super(targetType, itemTypeInfo); - } - - @Override - public String toString() { - return MessageFormat.format("IDREFS [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREFS(this); - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index 8fecc6d6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,519 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - - if (list) { - switch (id) { - case ID: - final MTypeInfo tid = new CMID(ti.getTargetType(), - ti); - return new CMList(createListType(tid.getTargetType()), - tid); - case IDREF: - return new CMIDREFS(createListType(ti.getTargetType()), - ti); - default: - return new CMList(createListType(ti.getTargetType()), ti); - } - } else { - switch (id) { - case ID: - return new CMID(ti.getTargetType(), ti); - case IDREF: - return new CMIDREF(ti.getTargetType(), ti); - default: - return ti; - } - } - - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - protected MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), createBaseTypeInfo(info), - info.isElement() ? info.getElementName() : null); - } - - protected MClassTypeInfo createBaseTypeInfo(CI info) { - return info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MClassInfo getScope(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract String getLocalName(EI info); - - protected abstract MPackageInfo getPackage(EI info); - - protected abstract MContainer getContainer(CI info); - - protected abstract MContainer getContainer(EI info); - - protected abstract MContainer getContainer(ELI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), getTypeInfo(baseType), - info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - getContainer(element), getLocalName(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 1e50748c..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index e3ee1ebd..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final CMCustomizations customizations = new CMCustomizations(); - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 85cc5a38..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - - public String getLocalName() { - return null; - } - - public String getContainerLocalName(String delimiter) { - return null; - } - - public MPackageInfo getPackageInfo() { - return this; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index 196a11bd..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo, - MCustomizable { - - private CMCustomizations customizations = new CMCustomizations(); - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index 5f9236b9..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - private final MCustomizations customizations = new CMCustomizations(); - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index c92e2e84..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitID(MID info) { - return visitTypeInfo(info); - } - - public V visitIDREF(MIDREF info) { - return visitTypeInfo(info); - } - - public V visitIDREFS(MIDREFS info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } - - public V visitClassRef(MClassRef info) { - return visitTypeInfo(info); - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java deleted file mode 100644 index 43c96d12..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -public class PackageInfoQNameAnalyzer { - - private final MModelInfo modelInfo; - - public PackageInfoQNameAnalyzer(MModelInfo modelInfo) { - Validate.notNull(modelInfo); - this.modelInfo = modelInfo; - } - - public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - counter.add(name.getNamespaceURI()); - } - - public void attribute(QName name) { - - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - } - - public void attribute(QName name) { - counter.add(name.getNamespaceURI()); - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - private void collectNamespaceURIs(MPackageInfo packageInfo, - final QNameCollector collector) { - for (MElementInfo elementInfo : modelInfo.getElementInfos()) { - if (elementInfo.getPackageInfo() == packageInfo) { - collector.element(elementInfo.getElementName()); - } - } - - final QNameCollectingPropertyInfoVisitor visitor = new QNameCollectingPropertyInfoVisitor( - collector); - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - if (classInfo.getPackageInfo() == packageInfo) { - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - propertyInfo.acceptPropertyInfoVisitor(visitor); - } - } - } - } - - private static class NamespaceURICounter { - private Map map = new HashMap(); - - public void add(String namespaceURI) { - final Integer count = map.get(namespaceURI); - if (count == null) { - map.put(namespaceURI, Integer.valueOf(1)); - } else { - map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); - } - } - - public String getMostUsedNamespaceURI() { - String namespaceURI = null; - int count = 0; - - for (Map.Entry e : map.entrySet()) { - final String currentNamespaceURI = e.getKey(); - final int currentCount = e.getValue(); - if (namespaceURI == null) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } else { - if (currentCount > count - || (currentCount == count && namespaceURI == null)) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } - } - } - - return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; - - } - - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java deleted file mode 100644 index 6729008e..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class QNameCollectingPropertyInfoVisitor implements - MPropertyInfoVisitor { - - private final QNameCollector collector; - - public QNameCollectingPropertyInfoVisitor(QNameCollector collector) { - Validate.notNull(collector); - this.collector = collector; - } - - public Void visitElementPropertyInfo(MElementPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementsPropertyInfo(MElementsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } - - public Void visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return null; - } - - public Void visitAttributePropertyInfo(MAttributePropertyInfo info) { - collector.attribute(info.getAttributeName()); - return null; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - return null; - } - - public Void visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java deleted file mode 100644 index 2bd50907..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -public interface QNameCollector { - - public void element(QName name); - - public void attribute(QName name); -} diff --git a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.8.1/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.8.1/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.8.1/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.8.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.8.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.8.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.8.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.8.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.8.1/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.8.1/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.8.1/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.8.1/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/basic/pom.xml b/basics/tags/0.8.1/samples/basic/pom.xml deleted file mode 100644 index a9623aa9..00000000 --- a/basics/tags/0.8.1/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.8.1 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/basic/project-build.xml b/basics/tags/0.8.1/samples/basic/project-build.xml deleted file mode 100644 index 05001052..00000000 --- a/basics/tags/0.8.1/samples/basic/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/basic/project-pom.xml b/basics/tags/0.8.1/samples/basic/project-pom.xml deleted file mode 100644 index 2909b2d1..00000000 --- a/basics/tags/0.8.1/samples/basic/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/basic/src/main/assembly/src.xml b/basics/tags/0.8.1/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.8.1/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.8.1/samples/basic/src/main/java/.placeholder b/basics/tags/0.8.1/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.1/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.8.1/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.8.1/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.8.1/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.1/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.8.1/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.1/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/basic/src/test/samples/1.xml b/basics/tags/0.8.1/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.1/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.1/samples/modular-ant/pom.xml b/basics/tags/0.8.1/samples/modular-ant/pom.xml deleted file mode 100644 index 6cc2d576..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4-SNAPSHOT - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/modular-ant/project-build.xml b/basics/tags/0.8.1/samples/modular-ant/project-build.xml deleted file mode 100644 index a2fc3e3a..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.8.1/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.8.1/samples/modular-ant/src/main/java/.placeholder b/basics/tags/0.8.1/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.1/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.8.1/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.1/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.8.1/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.8.1/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.1/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.1/samples/po/pom.xml b/basics/tags/0.8.1/samples/po/pom.xml deleted file mode 100644 index bcb43000..00000000 --- a/basics/tags/0.8.1/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.8.1 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/po/project-build.xml b/basics/tags/0.8.1/samples/po/project-build.xml deleted file mode 100644 index 4523094a..00000000 --- a/basics/tags/0.8.1/samples/po/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/po/project-pom.xml b/basics/tags/0.8.1/samples/po/project-pom.xml deleted file mode 100644 index edf3ced9..00000000 --- a/basics/tags/0.8.1/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/po/src/main/java/.placeholder b/basics/tags/0.8.1/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.1/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.8.1/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.8.1/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.8.1/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.8.1/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.8.1/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.8.1/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.1/samples/po/src/test/resources/log4j.properties b/basics/tags/0.8.1/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.1/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/po/src/test/samples/po.xml b/basics/tags/0.8.1/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.8.1/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/pom.xml b/basics/tags/0.8.1/samples/pom.xml deleted file mode 100644 index c6c180ef..00000000 --- a/basics/tags/0.8.1/samples/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.1 - ../pom.xml - - - po - basic - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/samples/src/main/assembly/ant-src.xml b/basics/tags/0.8.1/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.8.1/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.8.1/samples/src/main/assembly/maven-src.xml b/basics/tags/0.8.1/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.8.1/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.8.1/testing/.classpath b/basics/tags/0.8.1/testing/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.1/testing/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/testing/.project b/basics/tags/0.8.1/testing/.project deleted file mode 100644 index 4ead1953..00000000 --- a/basics/tags/0.8.1/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.1/testing/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.1/testing/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a8..00000000 --- a/basics/tags/0.8.1/testing/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.1/testing/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.1/testing/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.1/testing/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.1/testing/pom.xml b/basics/tags/0.8.1/testing/pom.xml deleted file mode 100644 index f412b17b..00000000 --- a/basics/tags/0.8.1/testing/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.1 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.1/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.8.1/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.8.1/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.8.1/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.8.1/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.8.1/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.8.1/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.8.1/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.8.1/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.8.1/testing/src/test/samples/1.xml b/basics/tags/0.8.1/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/tags/0.8.1/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.8.1/testing/src/test/samples/2.xml b/basics/tags/0.8.1/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/tags/0.8.1/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/build-1.5.bat b/basics/tags/0.8.1/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.8.1/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/build-1.6.bat b/basics/tags/0.8.1/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.8.1/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/episodes/a/pom.xml b/basics/tags/0.8.1/tests/episodes/a/pom.xml deleted file mode 100644 index 402c2054..00000000 --- a/basics/tags/0.8.1/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.8.1 - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.8.1/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.8.1/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.8.1/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.8.1/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.8.1/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.8.1/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.8.1/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/episodes/b/pom.xml b/basics/tags/0.8.1/tests/episodes/b/pom.xml deleted file mode 100644 index 6d39092d..00000000 --- a/basics/tags/0.8.1/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.8.1 - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.8.1/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.8.1/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.8.1/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.8.1/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.8.1/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.8.1/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.8.1/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.8.1/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.8.1/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/episodes/pom.xml b/basics/tags/0.8.1/tests/episodes/pom.xml deleted file mode 100644 index 12b6da8c..00000000 --- a/basics/tags/0.8.1/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.1 - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/ignoring/pom.xml b/basics/tags/0.8.1/tests/ignoring/pom.xml deleted file mode 100644 index 9cc7e4ad..00000000 --- a/basics/tags/0.8.1/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.1/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.8.1/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.8.1/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/issues/.classpath b/basics/tags/0.8.1/tests/issues/.classpath deleted file mode 100644 index b936c996..00000000 --- a/basics/tags/0.8.1/tests/issues/.classpath +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/tests/issues/.project b/basics/tags/0.8.1/tests/issues/.project deleted file mode 100644 index e6e2d74a..00000000 --- a/basics/tags/0.8.1/tests/issues/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.1/tests/issues/pom.xml b/basics/tags/0.8.1/tests/issues/pom.xml deleted file mode 100644 index 7ef1234a..00000000 --- a/basics/tags/0.8.1/tests/issues/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.1 - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -Xequals-equalsStrategyClass=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB42EqualsStrategy - -XhashCode - -Xcopyable - -Xmergeable - -Xmergeable-mergeStrategyClass=org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy - -Xinheritance - -Xsetters - -Xsetters-mode=direct - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - -Xsimplify - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java deleted file mode 100644 index 77921c47..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { - - @Override - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { - // Quasi custom equals - return super.equals(leftLocator, rightLocator, lhs, rhs); - } else { - return super.equals(leftLocator, rightLocator, lhs, rhs); - } - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java b/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java deleted file mode 100644 index ff1fb59f..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB48Interface { - - public T getValue(); - -} diff --git a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java b/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java deleted file mode 100644 index 25d45a45..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB53ABaseClass { - -} diff --git a/basics/tags/0.8.1/tests/issues/src/main/resources/binding.xjb b/basics/tags/0.8.1/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 947ed1a4..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,18 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - diff --git a/basics/tags/0.8.1/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.8.1/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 64b983aa..00000000 --- a/basics/tags/0.8.1/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB48Interface<java.lang.String> - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53ABaseClass - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53AType - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java deleted file mode 100644 index 746bc3b7..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB20Test extends TestCase { - - public void testException() throws Exception { - - final List strings = Arrays.asList("a", "b", "c"); - final IssueJIIB20 one = new IssueJIIB20(); - one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); - - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java deleted file mode 100644 index 01ba2358..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB44Test extends TestCase { - - private JAXBContext context; - - @Override - protected void setUp() throws Exception { - context = JAXBContext.newInstance(getClass().getPackage().getName()); - } - - public void testReferencesPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_0.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testReferencesPropertyAsReferencePropertyType() - throws Exception { - - IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_1.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testElementsPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_2.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getString().size()); - Assert.assertEquals(3, value.getInt().size()); - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 2ea29226..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); -// args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xsetters-mode=direct"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); - args.add("-Xannotate"); - args.add("-Xsimplify"); - return args; - } - -} diff --git a/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml deleted file mode 100644 index 0915dfad..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml deleted file mode 100644 index b811fb9b..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml deleted file mode 100644 index 0008e3ee..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - a - b - 0 - c - 1 - 2 - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.8.1/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.8.1/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/one/.classpath b/basics/tags/0.8.1/tests/one/.classpath deleted file mode 100644 index 95482320..00000000 --- a/basics/tags/0.8.1/tests/one/.classpath +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/tests/one/.project b/basics/tags/0.8.1/tests/one/.project deleted file mode 100644 index 855cd8c9..00000000 --- a/basics/tags/0.8.1/tests/one/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.1/tests/one/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.1/tests/one/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 90d24a88..00000000 --- a/basics/tags/0.8.1/tests/one/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding//target/generated-sources/xjc=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.1/tests/one/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.1/tests/one/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.1/tests/one/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.1/tests/one/pom.xml b/basics/tags/0.8.1/tests/one/pom.xml deleted file mode 100644 index 5a8a8745..00000000 --- a/basics/tags/0.8.1/tests/one/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.1 - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.1/tests/one/src/main/resources/binding.xjb b/basics/tags/0.8.1/tests/one/src/main/resources/binding.xjb deleted file mode 100644 index 3888abb4..00000000 --- a/basics/tags/0.8.1/tests/one/src/main/resources/binding.xjb +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/tests/one/src/main/resources/schema.xsd b/basics/tags/0.8.1/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index e527b565..00000000 --- a/basics/tags/0.8.1/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.8.1/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.1/tests/one/src/test/resources/log4j.properties b/basics/tags/0.8.1/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.1/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/one/src/test/samples/1.xml b/basics/tags/0.8.1/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.1/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.1/tests/one/src/test/samples/2.xml b/basics/tags/0.8.1/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.8.1/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.8.1/tests/pom.xml b/basics/tags/0.8.1/tests/pom.xml deleted file mode 100644 index fc8c7b39..00000000 --- a/basics/tags/0.8.1/tests/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.1 - ../pom.xml - - - episodes - one - issues - zj - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - generate - - generate - - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/wildcard/.classpath b/basics/tags/0.8.1/tests/wildcard/.classpath deleted file mode 100644 index fc04c651..00000000 --- a/basics/tags/0.8.1/tests/wildcard/.classpath +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/tests/wildcard/.project b/basics/tags/0.8.1/tests/wildcard/.project deleted file mode 100644 index 0636b2c4..00000000 --- a/basics/tags/0.8.1/tests/wildcard/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-wildcard - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.1/tests/wildcard/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.1/tests/wildcard/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 04cfa2c1..00000000 --- a/basics/tags/0.8.1/tests/wildcard/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.1/tests/wildcard/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.1/tests/wildcard/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.1/tests/wildcard/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.1/tests/wildcard/pom.xml b/basics/tags/0.8.1/tests/wildcard/pom.xml deleted file mode 100644 index dcb22a75..00000000 --- a/basics/tags/0.8.1/tests/wildcard/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-wildcard - jar - JAXB2 Basics - Test [wildcard] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xwildcard - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.1/tests/wildcard/src/main/resources/binding.xjb b/basics/tags/0.8.1/tests/wildcard/src/main/resources/binding.xjb deleted file mode 100644 index 8f780f74..00000000 --- a/basics/tags/0.8.1/tests/wildcard/src/main/resources/binding.xjb +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/basics/tags/0.8.1/tests/wildcard/src/main/resources/schema.xsd b/basics/tags/0.8.1/tests/wildcard/src/main/resources/schema.xsd deleted file mode 100644 index 7d520ce9..00000000 --- a/basics/tags/0.8.1/tests/wildcard/src/main/resources/schema.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/zj/pom.xml b/basics/tags/0.8.1/tests/zj/pom.xml deleted file mode 100644 index 404980a0..00000000 --- a/basics/tags/0.8.1/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.1 - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.1/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.8.1/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.8.1/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.8.1/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.8.1/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.1/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.8.1/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.1/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.1/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.8.1/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.8.1/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.8.1/tools/.classpath b/basics/tags/0.8.1/tools/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.1/tools/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.1/tools/.project b/basics/tags/0.8.1/tools/.project deleted file mode 100644 index e7b0094b..00000000 --- a/basics/tags/0.8.1/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.1/tools/pom.xml b/basics/tags/0.8.1/tools/pom.xml deleted file mode 100644 index 7659478c..00000000 --- a/basics/tags/0.8.1/tools/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - 0.8.1 - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.1 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - org.apache.commons - commons-lang3 - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index f67cc957..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!(namespaceURI== null || namespaceURI.length() == 0)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d3644156..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 176d5a2c..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,654 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(Outline outline, QName name) { - final CPluginCustomization customization = findCustomization(outline, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(Model model, QName name) { - final CPluginCustomization customization = findCustomization(model, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(EnumOutline enumOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - enumOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - Outline outline, QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CEnumLeafInfo enumLeafInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - enumLeafInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Outline outline, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(outline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Outline outline) { - return getCustomizations(outline.getModel()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index c65295d2..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public boolean isAlwaysSet() { - if (constantField != null) { - return true; - } else { - return JExpr.TRUE == fieldAccessor.hasSetValue(); - } - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - if (isAlwaysSet()) { - block.assign($var, targetObject.invoke(getter)); - } else { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index cb6e5928..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(final MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = classInfo - .getBaseTypeInfo() - .acceptClassTypeInfoVisitor( - new MClassTypeInfoVisitor() { - @Override - public MClassOutline visitClassInfo( - MClassInfo info) { - return parent.getParent().getClassOutline( - info); - } - - @Override - public MClassOutline visitClassRef( - MClassRef info) { - return null; - } - }); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 15e216be..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 8178879e..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 0e5b4ec1..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index bb384e2f..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(final CMModelOutline modelOutline, - final MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - classInfo.getBaseTypeInfo().acceptClassTypeInfoVisitor( - new MClassTypeInfoVisitor() { - @Override - public Void visitClassInfo( - MClassInfo info) { - generateClassOutline(modelOutline, modelInfo, info); - return null; - } - - @Override - public Void visitClassRef(MClassRef info) { - return null; - } - }); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index b045735f..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index 344bc3f7..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 656f8d82..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,394 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - private final Map> classRefs = - - new IdentityHashMap>(); - - public XJCCMInfoFactory(Model model) { - super(model); - } - - protected NClass getClazz(CClassRef info) { - return info; - } - - protected NClass getClazz(final Class _clas) { - return new NClass() { - - @Override - public boolean isBoxedType() { - return false; - } - - @Override - public String fullName() { - return _clas.getName(); - } - - @Override - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(_clas); - } - - @Override - public boolean isAbstract() { - return false; - } - }; - } - - protected NClass getClazz(final String className) { - return new NClass() { - - @Override - public boolean isBoxedType() { - return false; - } - - @Override - public String fullName() { - return className; - } - - @Override - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(className); - } - - @Override - public boolean isAbstract() { - return false; - } - }; - } - - protected MClassRef createClassRef(Class _class) { - return new CMClassRef(getClazz(_class), - getPackage(_class), getContainer(_class), getLocalName(_class)); - } - - protected MClassRef getTypeInfo(CClassRef info) { - - MClassRef classInfo = classRefs.get(info); - - if (classInfo == null) { - - classInfo = createClassRef(info); - classRefs.put(info, classInfo); - } - return classInfo; - } - - protected MClassRef createClassRef(CClassRef info) { - return new CMClassRef(getClazz(info), getPackage(info), - getContainer(info), getLocalName(info)); - } - - @Override - protected MTypeInfo getTypeInfo(CTypeInfo typeInfo) { - if (typeInfo instanceof CClassRef) { - return getTypeInfo((CClassRef) typeInfo); - } else { - return super.getTypeInfo(typeInfo); - } - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - protected MPackageInfo getPackage(CClassRef info) { - final String fullName = info.fullName(); - return getPackage(fullName); - } - - private MPackageInfo getPackage(final String fullName) { - try { - final Class _class = Class.forName(fullName); - return getPackage(_class); - } catch (ClassNotFoundException cnfex) { - final String packageName; - final int lastIndexOfDot = fullName.lastIndexOf('.'); - if (lastIndexOfDot != -1) { - packageName = fullName.substring(0, lastIndexOfDot); - } else { - packageName = ""; - } - return new CMPackageInfo(new CMPackageInfoOrigin(), packageName); - } - } - - private MPackageInfo getPackage(final Class _class) { - final Package _package = _class.getPackage(); - return new CMPackageInfo(new CMPackageInfoOrigin(), _package.getName()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - @Override - protected MContainer getContainer(CClassInfo info) { - final CClassInfoParent parent = info.parent(); - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CElementInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CEnumLeafInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - protected MContainer getContainer(CClassRef info) { - final String fullName = info.fullName(); - try { - final Class _class = Class.forName(fullName); - return getContainer(_class); - } catch (ClassNotFoundException cnfex) { - return getPackage(info); - } - } - - private MContainer getContainer(final Class _class) { - final Class enclosingClass = _class.getEnclosingClass(); - if (enclosingClass == null) { - return getPackage(_class); - } else { - return createClassRef(enclosingClass); - } - } - - private final Map packages = new HashMap(); - - private MContainer getContainer(CClassInfoParent parent) { - return parent.accept(new Visitor() { - - public MContainer onBean(CClassInfo bean) { - return getTypeInfo(bean); - } - - public MContainer onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MContainer onElement(CElementInfo element) { - return getElementInfo(element); - } - }); - } - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected MClassInfo getScope(CClassInfo info) { - return info.getScope() == null ? null : getTypeInfo(info.getScope()); - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - protected String getLocalName(CClassRef info) { - final String fullName = info.fullName(); - try { - final Class _class = Class.forName(fullName); - return getLocalName(_class); - } catch (ClassNotFoundException cnfex) { - return getLocalName(fullName); - } - } - - private String getLocalName(final String fullName) { - final int lastIndexOfDollar = fullName.lastIndexOf('$'); - if (lastIndexOfDollar != -1) { - return fullName.substring(lastIndexOfDollar + 1); - } - final int lastIndexOfDot = fullName.lastIndexOf('.'); - if (lastIndexOfDot != -1) { - return fullName.substring(lastIndexOfDot + 1); - } - return fullName; - } - - private String getLocalName(final Class _class) { - return _class.getSimpleName(); - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CElementInfo info) { - return info.shortName(); - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } - - private MPackageInfo getPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - @Override - protected MClassTypeInfo createBaseTypeInfo(CClassInfo info) { - if (info.getBaseClass() != null) { - return getTypeInfo(info.getBaseClass()); - } else if (info.getRefBaseClass() != null) { - return getTypeInfo(info.getRefBaseClass()); - } else { - return null; - } - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 28ed69a4..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index 51ee09b5..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); - - public boolean isAlwaysSet(); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index e977655d..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 033acf34..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 369c9768..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index d89918aa..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 11444b09..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index 96e82667..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index 85bd7b16..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index 67a576c1..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 41c9d885..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 74b7bd87..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index be5334e4..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index f4f9e307..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c8b7f118..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 91362018..00000000 --- a/basics/tags/0.8.1/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/tags/0.8.2/ant/.classpath b/basics/tags/0.8.2/ant/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.2/ant/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/ant/.project b/basics/tags/0.8.2/ant/.project deleted file mode 100644 index 63b92b0b..00000000 --- a/basics/tags/0.8.2/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.2/ant/pom.xml b/basics/tags/0.8.2/ant/pom.xml deleted file mode 100644 index d1bcf838..00000000 --- a/basics/tags/0.8.2/ant/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-ant - jar - JAXB2 Basics - Ant Task - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.2 - ../pom.xml - - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.apache.ant - ant - provided - - - org.apache.ant - ant-launcher - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.2/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/tags/0.8.2/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/tags/0.8.2/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/tags/0.8.2/basic/.classpath b/basics/tags/0.8.2/basic/.classpath deleted file mode 100644 index 5d675fc8..00000000 --- a/basics/tags/0.8.2/basic/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/basic/.project b/basics/tags/0.8.2/basic/.project deleted file mode 100644 index 9ef5e932..00000000 --- a/basics/tags/0.8.2/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.2/basic/pom.xml b/basics/tags/0.8.2/basic/pom.xml deleted file mode 100644 index 54e8f3d3..00000000 --- a/basics/tags/0.8.2/basic/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics - jar - 0.8.2 - JAXB2 Basics - Basic Plugins - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.2 - ../pom.xml - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - com.google.code.javaparser - javaparser - 1.0.11 - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - - install - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.felix - - - maven-bundle-plugin - - - [2.3.7,) - - - manifest - - - - - - - - - - org.jvnet.jaxb2.maven2 - - - maven-jaxb2-plugin - - - [0.8.1,) - - - generate - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 176f243b..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(EnumOutline enumOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 0d007353..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(EnumOutline enumOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index ca56dce8..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,335 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String copyStrategyClass = JAXBCopyStrategy.class.getName(); - - public void setCopyStrategyClass(final String copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public String getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, - codeModel.ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, - codeModel.ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl( - JMod.FINAL, - theClass.owner().ref(Object.class), - "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), - JExpr.invoke("createNewInstance"), target)); - } else { - body._if(JExpr._null().eq(target)) - ._then() - ._throw(JExpr - ._new(theClass.owner().ref( - IllegalArgumentException.class)) - .arg("Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator) - .arg(draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", - JExpr.cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (!sourceFieldAccessor.isAlwaysSet() - && valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr - .invoke(copyStrategy, "copy") - .arg(theClass - .owner() - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), - copyFieldType.isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java deleted file mode 100644 index 0b550431..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/enumvalue"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java deleted file mode 100644 index 177a950c..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.EnumValue; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EnumValuePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XenumValue"; - } - - @Override - public String getUsage() { - return "Forces generated @XmlEnums implement the org.jvnet.jaxb2_commons.lang.EnumValue interface."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final EnumOutline enumOutline : outline.getEnums()) { - if (!getIgnoring().isIgnored(enumOutline)) { - processEnumOutline(enumOutline); - } - } - return true; - } - - protected void processEnumOutline(EnumOutline enumOutline) { - CEnumLeafInfo enumLeafInfo = enumOutline.target; - JClass enumType = enumLeafInfo.base.toType(enumOutline.parent(), - Aspect.EXPOSED).boxify(); - - final JDefinedClass theClass = enumOutline.clazz; - - ClassUtils._implements(theClass, theClass.owner().ref(EnumValue.class) - .narrow(enumType)); - - final JMethod enumValue$enumValue = theClass.method(JMod.PUBLIC, - enumType, "enumValue"); - enumValue$enumValue.body()._return(JExpr._this().invoke("value")); - } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 5d35be2b..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); - - public void setEqualsStrategyClass(String equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public String getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - // - // @SuppressWarnings("unused") - // final JMethod equals$equals = generateEquals$equals(enumOutline, - // theClass); - // } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } - - // protected JMethod generateEquals$equals(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // final JCodeModel codeModel = theClass.owner(); - // final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - // "equals"); - // - // { - // final JBlock body = equals.body(); - // final JVar leftLocator = equals.param(ObjectLocator.class, - // "thisLocator"); - // final JVar rightLocator = equals.param(ObjectLocator.class, - // "thatLocator"); - // final JVar object = equals.param(Object.class, "object"); - // final JVar equalsStrategy = equals.param(EqualsStrategy.class, - // "strategy"); - // - // body._return(equalsStrategy - // .invoke("equals") - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(leftLocator) - // .arg("value").arg(JExpr._this().ref("value"))) - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(rightLocator) - // .arg("value").arg(object.ref("value"))) - // .arg(JExpr._this().ref("value")).arg(object.ref("value"))); - // - // } - // return equals; - // } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index 571b6fbe..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); - - public void setHashCodeStrategyClass(String hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public String getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - // - // // @SuppressWarnings("unused") - // // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode = generateHashCode$hashCode( - // enumOutline, theClass); - // // @SuppressWarnings("unused") - // // final JMethod object$hashCode = generateObject$hashCode(enumOutline, - // // theClass); - // } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - return generateObject$hashCode(theClass); - } - - // protected JMethod generateObject$hashCode(final EnumOutline enumOutline, - // final JDefinedClass theClass) { - // return generateObject$hashCode(theClass); - // } - - private JMethod generateObject$hashCode(final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, - theClass.owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass - .owner().ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl( - fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign( - currentHashCode, - hashCodeStrategy - .invoke("hashCode") - .arg(codeModel - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(theValue)) - .arg(currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } - - // protected JMethod generateHashCode$hashCode(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // JCodeModel codeModel = theClass.owner(); - // final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - // codeModel.INT, "hashCode"); - // final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - // "locator"); - // final JVar hashCodeStrategy = hashCode$hashCode.param( - // HashCodeStrategy.class, "strategy"); - // final JBlock body = hashCode$hashCode.body(); - // - // body._return(hashCodeStrategy - // .invoke("hashCode") - // .arg(codeModel.ref(LocatorUtils.class).staticInvoke("property") - // .arg(locator).arg("value") - // .arg(JExpr._this().ref("value"))).arg(JExpr.lit(1)) - // .arg(JExpr._this().ref("value"))); - // - // return hashCode$hashCode; - // } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index 0d8c96ec..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIEnum; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - final Map knownClasses = new HashMap(); - final Map knownClassInfos = new IdentityHashMap(); - - for (final ClassOutline classOutline : outline.getClasses()) { - knownClasses.put(classOutline.implClass.fullName(), - classOutline.implClass); - knownClassInfos.put(classOutline.implClass, classOutline.target); - } - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, knownClasses, knownClassInfos); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, knownClasses); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, knownClasses); - } - } - processPackageOutlines(outline, knownClasses); - return true; - } - - private void processClassOutline(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - - generateExtends(classOutline, knownClasses, knownClassInfos); - generateImplements(classOutline, knownClasses); - - } - - private void processEnumOutline(EnumOutline enumOutline, - Map knownClasses) { - - generateExtends(enumOutline, knownClasses); - generateImplements(enumOutline, knownClasses); - - } - - private void processElementOutline(ElementOutline elementOutline, - Map knownClasses) { - - generateExtends(elementOutline, knownClasses); - generateImplements(elementOutline, knownClasses); - - } - - private void processPackageOutlines(Outline outline, - Map knownClasses) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass, - knownClasses); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface, knownClasses); - } - } - } - } - } - } - } - } - - private JClass generateExtends(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - JClass targetClass = generateExtends(theClass, - extendsClassCustomization, knownClasses); - - final CClassInfo classInfo = classOutline.target; - if (targetClass != null && classInfo.getBaseClass() == null - && classInfo.getRefBaseClass() == null) { - final CClassInfo targetClassInfo = knownClassInfos.get(targetClass); - if (targetClassInfo == null && classInfo.getRefBaseClass() == null) { - final Model model = classInfo.model; - // BIEnum as BIClass is protected too much - final BIEnum decl = new BIEnum(); - decl.ref = targetClass.fullName(); - final CClassRef baseClass = new CClassRef(model, - classInfo.getSchemaComponent(), decl, - new CCustomizations()); - classInfo.setBaseClass(baseClass); - } else if (targetClassInfo != null - && classInfo.getBaseClass() == null) { - classInfo.setBaseClass(targetClassInfo); - } - } - return targetClass; - } - - private JClass generateExtends(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization, - Map knownClasses) throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - return generateExtends(theClass, extendsClass, knownClasses); - } else { - return null; - } - } - - private JClass generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass, Map knownClasses) { - if (extendsClass.getClassName() != null) { - final String _class = extendsClass.getClassName(); - final JClass targetClass = parseClass(_class, theClass.owner(), - knownClasses); - theClass._extends(targetClass); - return targetClass; - } else { - return null; - } - } - - private List generateImplements(ClassOutline classOutline, - Map knownClasses) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations, - Map knownClasses) throws AssertionError { - final List implementedInterfaces = new ArrayList( - implementsInterfaceCustomizations.size()); - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - - final JClass implementedInterface = generateImplements( - theClass, implementsInterface, knownClasses); - if (implementedInterface != null) { - implementedInterfaces.add(implementedInterface); - } - } - } - return implementedInterfaces; - } - - private JClass generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface, - Map knownClasses) { - - String _interface = implementsInterface.getInterfaceName(); - if (_interface != null) { - final JClass targetClass = parseClass(_interface, theClass.owner(), - knownClasses); - theClass._implements(targetClass); - return targetClass; - } else { - return null; - } - } - - private JClass parseClass(String _class, JCodeModel codeModel, - Map knownClasses) { - return new JavaTypeParser(knownClasses).parseClass(_class, codeModel); - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java deleted file mode 100644 index 233997ae..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.JavaParser; -import japa.parser.ParseException; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class JavaTypeParser { - - static { -// JavaParser.setCacheParser(false); - } - - private final TypeToJTypeConvertingVisitor typeToJTypeConvertingVisitor; - - public JavaTypeParser() { - this(Collections. emptyMap()); - } - - public JavaTypeParser(Map knownClasses) { - Validate.notNull(knownClasses); - this.typeToJTypeConvertingVisitor = new TypeToJTypeConvertingVisitor( - knownClasses); - - } - - public JClass parseClass(String _class, JCodeModel codeModel) { - JType type = parseType(_class, codeModel); - if (type instanceof JClass) { - return (JClass) type; - } else { - throw new IllegalArgumentException("Type [" + _class - + "] is not a class."); - } - } - - private JType parseType(String type, JCodeModel codeModel) { - final String text = "public class Ignored extends " + type + " {}"; - try { - CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - final List _extended = classDeclaration - .getExtends(); - final ClassOrInterfaceType classOrInterfaceType = _extended.get(0); - - return classOrInterfaceType.accept( - this.typeToJTypeConvertingVisitor, codeModel); - } catch (ParseException pex) { - throw new IllegalArgumentException( - "Could not parse the type definition [" + type + "].", pex); - } catch (UnsupportedEncodingException uex) { - throw new UnsupportedOperationException(uex); - } - } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java deleted file mode 100644 index 021d97b3..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; -import japa.parser.ast.visitor.GenericVisitorAdapter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class TypeToJTypeConvertingVisitor extends - GenericVisitorAdapter { - - private final Map knownClasses; - - public TypeToJTypeConvertingVisitor(Map knownClasses) { - Validate.notNull(knownClasses); - this.knownClasses = knownClasses; - } - - @Override - public JType visit(VoidType type, JCodeModel codeModel) { - return codeModel.VOID; - } - - @Override - public JType visit(PrimitiveType type, JCodeModel codeModel) { - switch (type.getType()) { - case Boolean: - return codeModel.BOOLEAN; - case Char: - return codeModel.CHAR; - case Byte: - return codeModel.BYTE; - case Short: - return codeModel.SHORT; - case Int: - return codeModel.INT; - case Long: - return codeModel.LONG; - case Float: - return codeModel.FLOAT; - case Double: - return codeModel.DOUBLE; - default: - throw new AssertionError("Unknown primitive type [" - + type.getType() + "]"); - } - } - - @Override - public JType visit(ReferenceType type, JCodeModel codeModel) { - final JType referencedType = type.getType().accept(this, codeModel); - - JType referencedTypeArray = referencedType; - for (int index = 0; index < type.getArrayCount(); index++) { - referencedTypeArray = referencedTypeArray.array(); - } - return referencedTypeArray; - } - - @Override - public JType visit(WildcardType type, JCodeModel codeModel) { - - if (type.getExtends() != null) { - final ReferenceType _extends = type.getExtends(); - final JType boundType = _extends.accept(this, codeModel); - - if (!(boundType instanceof JClass)) { - throw new IllegalArgumentException("Bound type [" + _extends - + "]in the wildcard type must be class."); - } - - final JClass boundClass = (JClass) boundType; - return boundClass.wildcard(); - } else if (type.getSuper() != null) { - // TODO - throw new IllegalArgumentException( - "Wildcard types with super clause are not supported at the moment."); - } else { - throw new IllegalArgumentException( - "Wildcard type must have either extends or super clause."); - } - } - - @Override - public JType visit(ClassOrInterfaceType type, JCodeModel codeModel) { - final String name = getName(type); - final JClass knownClass = this.knownClasses.get(name); - final JClass jclass = knownClass != null ? knownClass : codeModel - .ref(name); - final List typeArgs = type.getTypeArgs(); - if (typeArgs == null || typeArgs.isEmpty()) { - return jclass; - } else { - final List jtypeArgs = new ArrayList( - typeArgs.size()); - for (Type typeArg : typeArgs) { - final JType jtype = typeArg.accept(this, codeModel); - if (!(jtype instanceof JClass)) { - throw new IllegalArgumentException("Type argument [" - + typeArg.toString() + "] is not a class."); - } else { - jtypeArgs.add((JClass) jtype); - } - } - return jclass.narrow(jtypeArgs); - } - } - - private String getName(ClassOrInterfaceType type) { - final String name = type.getName(); - final ClassOrInterfaceType scope = type.getScope(); - if (scope == null) { - return name; - } else { - return getName(scope) + "." + name; - } - } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index c83e1901..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); - - public void setMergeStrategyClass( - final String mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public String getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index fbc662d6..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - public static enum Mode { - - accessor { - - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(setter.body()); - accessor.fromRawValue(setter.body(), "draft", value); - } - }, - direct { - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - - final JFieldVar field = theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - - if (field != null) { - setter.body().assign(JExpr._this().ref(field), value); - } else { - // Fallback to the accessor - Mode.accessor.generateSetter(fieldOutline, theClass, - setter, value); - } - } - }; - public abstract void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value); - } - - private Mode mode = Mode.accessor; - - public String getMode() { - return mode.name(); - - } - - public void setMode(String mode) { - Validate.notNull(mode); - try { - this.mode = Mode.valueOf(mode); - } catch (IllegalArgumentException iaex) { - throw new IllegalArgumentException( - "Unsupported mode [" - + mode - + "]." - + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" - + " and [direct] (assigns the value to the field directly)."); - } - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - - mode.generateSetter(fieldOutline, theClass, - generatedSetter, value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java deleted file mode 100644 index 783cf37b..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - - public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-element-property"); - - public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-reference-property"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java deleted file mode 100644 index 97de9dd7..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeRef; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.ID; - -public class SimplifyPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xsimplify"; - } - - @Override - public String getUsage() { - return "This plugin allows simplifying \"complex\" properties" - + " (ex. aOrBOrC generated from repeatable choices)" - + " into several \"simple\" properties (ex. a, b, c).\n" - + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" - + " for plugin documentation."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public void postProcessModel(final Model model, ErrorHandler errorHandler) { - - for (final CClassInfo classInfo : model.beans().values()) { - postProcessClassInfo(model, classInfo); - } - } - - private void postProcessClassInfo(final Model model, - final CClassInfo classInfo) { - final List properties = new ArrayList( - classInfo.getProperties()); - for (CPropertyInfo property : properties) { - property.accept(new CPropertyVisitor() { - - public Void onElement(CElementPropertyInfo elementProperty) { - postProcessElementPropertyInfo(model, classInfo, - elementProperty); - return null; - } - - public Void onAttribute(CAttributePropertyInfo attributeProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onValue(CValuePropertyInfo valueProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onReference(CReferencePropertyInfo p) { - postProcessReferencePropertyInfo(model, classInfo, p); - return null; - } - - }); - } - } - - private void postProcessElementPropertyInfo(final Model model, - final CClassInfo classInfo, CElementPropertyInfo property) { - if (property.isCollection() && property.getTypes().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyElementPropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } - } - } - - private void postProcessReferencePropertyInfo(final Model model, - final CClassInfo classInfo, CReferencePropertyInfo property) { - if (property.isCollection() && property.getElements().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } else if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsReferencePropertyInfo(model, - classInfo, property); - } - } - } - - private void simplifyElementPropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CElementPropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CTypeRef typeRef : property.getTypes()) { - final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( - model, property, typeRef); - classInfo.getProperties().add(index++, elementPropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsReferencePropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( - model, property, element); - classInfo.getProperties().add(index++, referencePropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CElementPropertyInfo elementPropertyInfo; - if (element instanceof CElementInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CElementInfo) element); - } else if (element instanceof CClassInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CClassInfo) element); - - } else if (element instanceof CClassRef) { - // elementPropertyInfo = createElementPropertyInfo(model, - // element, - // (CClassRef) element); - elementPropertyInfo = null; - // TODO WARN - - } else { - // TODO WARN - elementPropertyInfo = null; - } - if (elementPropertyInfo != null) { - classInfo.getProperties().add(index++, elementPropertyInfo); - } - } - classInfo.getProperties().remove(property); - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CElementInfo elementInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(elementInfo.getContentType(), element - .getElementName(), elementInfo.getContentType() - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CClassInfo classInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(classInfo, element.getElementName(), classInfo - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - // private CElementPropertyInfo createElementPropertyInfo(final Model model, - // CElement element, final CClassRef cr) { - // final CElementPropertyInfo elementPropertyInfo; - // final String propertyName = createPropertyName(model, element); - // elementPropertyInfo = new CElementPropertyInfo(propertyName, - // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - // element.getSchemaComponent(), element.getCustomizations(), - // element.getLocator(), false); - // elementPropertyInfo.getTypes().add( - // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), - // false, null)); - // return elementPropertyInfo; - // } - - private CReferencePropertyInfo createReferencePropertyInfo( - final Model model, CReferencePropertyInfo property, CElement element) { - final String propertyName = createPropertyName(model, element); - final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( - propertyName, true, false, property.isMixed(), - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), property.isDummy(), property.isContent(), - property.isMixedExtendedCust()); - referencePropertyInfo.getElements().add(element); - return referencePropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElementPropertyInfo property, CTypeRef typeRef) { - final String propertyName = createPropertyName(model, typeRef); - boolean required = false; - final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( - propertyName, CollectionMode.REPEATED_ELEMENT, typeRef - .getTarget().idUse(), typeRef.getTarget() - .getExpectedMimeType(), property.getSchemaComponent(), - property.getCustomizations(), property.getLocator(), required); - elementPropertyInfo.getTypes().add(typeRef); - return elementPropertyInfo; - } - - private String createPropertyName(final Model model, CElement element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getElementName().getLocalPart()); - return propertyName; - } - - private String createPropertyName(final Model model, CTypeRef element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getTagName().getLocalPart()); - return propertyName; - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index dc8eac3c..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); - - public void setToStringStrategyClass( - String toStringStrategy) { - this.toStringStrategyClass = toStringStrategy; - } - - public String getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 6f95d0b1..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final String strategyClassName) { - - try { - final Class strategyClass = Class.forName(strategyClassName); - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } catch (ClassNotFoundException cnfex) { - final JClass strategyJClass = codeModel.ref(strategyClassName); - return JExpr._new(strategyJClass); - } - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index b44a1cb3..00000000 --- a/basics/tags/0.8.2/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - final boolean laxModel = CustomizationUtils.containsCustomization( - model, Customizations.LAX_ELEMENT_NAME); - final boolean skipModel = CustomizationUtils.containsCustomization( - model, Customizations.SKIP_ELEMENT_NAME); - final boolean strictModel = CustomizationUtils.containsCustomization( - model, Customizations.STRICT_ELEMENT_NAME); - for (CClassInfo classInfo : model.beans().values()) { - final boolean laxClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.STRICT_ELEMENT_NAME); - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - final boolean laxPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME); - - if (laxModel) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipModel) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictModel) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/tags/0.8.2/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/tags/0.8.2/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 99ef7147..00000000 --- a/basics/tags/0.8.2/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,13 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin -org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin -org.jvnet.jaxb2_commons.plugin.enumvalue.EnumValuePlugin \ No newline at end of file diff --git a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java b/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java deleted file mode 100644 index 30bdf587..00000000 --- a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; - -public class JavaParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final JavaTypeParser javaTypeParser = new JavaTypeParser(); - final JCodeModel codeModel = new JCodeModel(); - JClass comparator = javaTypeParser.parseClass("java.util.Comparator", - codeModel); - assertNotNull(comparator); - JClass integerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(integerComparator); - JClass wildcardIntegerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(wildcardIntegerComparator); - } -} diff --git a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java b/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java deleted file mode 100644 index a2562048..00000000 --- a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; - -import java.io.ByteArrayInputStream; -import java.util.List; - -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - assertEquals(1, typeDeclarations.size()); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - assertEquals("Dummy", classDeclaration.getName()); - final List implementedInterfaces = classDeclaration - .getImplements(); - assertEquals(1, implementedInterfaces.size()); - final ClassOrInterfaceType implementedInterface = implementedInterfaces - .get(0); - assertEquals("Comparator", implementedInterface.getName()); - final List typeArgs = implementedInterface.getTypeArgs(); - assertEquals(1, typeArgs.size()); - final Type typeArg = typeArgs.get(0); - assertTrue(typeArg instanceof ReferenceType); - final ReferenceType referenceTypeArg = (ReferenceType) typeArg; - final Type referencedType = referenceTypeArg.getType(); - assertTrue(referencedType instanceof ClassOrInterfaceType); - final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; - assertEquals("Integer", typeArgType.getName()); - - } -} diff --git a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/tags/0.8.2/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/tags/0.8.2/basic/src/test/resources/schema.xsd b/basics/tags/0.8.2/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/tags/0.8.2/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/build-1.6.bat b/basics/tags/0.8.2/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.8.2/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.2/deploy.bat b/basics/tags/0.8.2/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/tags/0.8.2/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/tags/0.8.2/dist/pom.xml b/basics/tags/0.8.2/dist/pom.xml deleted file mode 100644 index 2a6d462d..00000000 --- a/basics/tags/0.8.2/dist/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-dist - pom - JAXB2 Basics - Dist - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.2 - ../pom.xml - - - - false - org.highsource.repository.maven2.releases - ${sftp.repository.highsource.org}/maven2/releases - - - false - org.highsource.repository.maven2.snapshots - ${sftp.repository.highsource.org}/maven2/snapshots - - - ${sftp.static.highsource.org}/jaxb2-basics/dist - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - javadoc - - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - sources - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - javadoc - - - - install - - - maven-assembly-plugin - 2.2-beta-3 - true - - - dist-assembly - package - - attached - - - - src/main/assembly/dist.xml - src/main/assembly/dist-with-dependencies.xml - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - diff --git a/basics/tags/0.8.2/dist/src/main/assembly/dist-with-dependencies.xml b/basics/tags/0.8.2/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/tags/0.8.2/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.8.2/dist/src/main/assembly/dist.xml b/basics/tags/0.8.2/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/tags/0.8.2/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/tags/0.8.2/install-1.6.bat b/basics/tags/0.8.2/install-1.6.bat deleted file mode 100644 index 57a75b67..00000000 --- a/basics/tags/0.8.2/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -Psamples,tests,dist clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.2/install.bat b/basics/tags/0.8.2/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/tags/0.8.2/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/tags/0.8.2/jaxb/pom.xml b/basics/tags/0.8.2/jaxb/pom.xml deleted file mode 100644 index 2ad49ae7..00000000 --- a/basics/tags/0.8.2/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 7 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/jaxb/release.bat b/basics/tags/0.8.2/jaxb/release.bat deleted file mode 100644 index e6784200..00000000 --- a/basics/tags/0.8.2/jaxb/release.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn clean deploy -DperformRelease=true -Psonatype-oss-release \ No newline at end of file diff --git a/basics/tags/0.8.2/jaxb/xjc/pom.xml b/basics/tags/0.8.2/jaxb/xjc/pom.xml deleted file mode 100644 index a2a60692..00000000 --- a/basics/tags/0.8.2/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.4 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/pom.xml b/basics/tags/0.8.2/pom.xml deleted file mode 100644 index c1b20485..00000000 --- a/basics/tags/0.8.2/pom.xml +++ /dev/null @@ -1,334 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-project - pom - 0.8.2 - JAXB2 Basics - Project - http://static.highsource.org/jaxb2-basics - JAXB2 Basics is a part of JAXB2 Commons project which implements plugins and tools for JAXB 2.x reference implementation. - - org.sonatype.oss - oss-parent - 7 - - - JIRA - http://jira.highsource.org/browse/JIIB - - 2005 - - - Users List - users-subscribe@jaxb.java.net - users-unsubscribe@jaxb.java.net - users@jaxb.java.net - http://java.net/projects/jaxb/lists/users/archive - - - - - lexi - Aleksei Valikov - valikov@gmx.net - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - - - - - - BSD-Style License - http://confluence.highsource.org/display/J2B/License - repo - JAXB2 Basics license is the 3-clause BSD license which is compatible with GPL. JAXB2 Basics license does not require you to include any acknowledgments for JAXB2 Basics in advertising materials for your software. - - - - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - scm:svn:https://svn.java.net/svn/jaxb2-commons~svn/basics/trunk - http://java.net/projects/jaxb2-commons/sources/svn/show/basics/trunk - - - ant - runtime - tools - testing - basic - - - - samples - - - samples - - - - samples - - - - tests - - - tests - - - - tests - - - - dist - - - dist - - - - dist - - - - - 2.2.5-2 - 0.9.0 - - - - - junit - junit - test - - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - ${maven-jaxb2-plugin.version} - - - - javax.xml.bind - jaxb-api - 2.1 - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - com.sun.xml.bind - jaxb-xjc - ${jaxb.version} - - - - junit - junit - 3.8.1 - - - - org.apache.commons - commons-lang3 - 3.2.1 - - - commons-io - commons-io - 1.2 - - - commons-beanutils - commons-beanutils - 1.7.0 - - - commons-logging - commons-logging - 1.1.1 - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - - log4j - log4j - 1.2.13 - - - - org.springframework - spring - 2.0.7 - - - - xmlunit - xmlunit - 1.0 - - - - org.apache.ant - ant - 1.7.0 - - - org.apache.ant - ant-launcher - 1.7.0 - - - - - install - - - - org.apache.maven.plugins - maven-release-plugin - 2.1 - - forked-path - false - -Psonatype-oss-release -Psamples - - - - true - maven-compiler-plugin - - 1.6 - 1.6 - - - - maven-source-plugin - - - attach-source - - jar - - - - - - maven-antrun-plugin - true - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - junit - junit - 3.8.1 - runtime - - - ant - ant-optional - 1.5.3-1 - - - - - - - - maven-source-plugin - - - attach-source - - jar - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-jxr-plugin - - - - diff --git a/basics/tags/0.8.2/qrelease.bat b/basics/tags/0.8.2/qrelease.bat deleted file mode 100644 index c71e5e88..00000000 --- a/basics/tags/0.8.2/qrelease.bat +++ /dev/null @@ -1,76 +0,0 @@ -setlocal -echo Setting JAVA_HOME to %JAVA6_HOME%. -set JAVA_HOME=%JAVA6_HOME% - -echo Performing a short clean build. -rem pause -call mvn clean install -DperformRelease -echo Short clean build completed. -rem pause - -echo Performing a full clean build. -rem pause -call mvn clean install -DperformRelease -Psamples,tests,dist -echo Full clean build completed. -rem pause - -echo Setting new version to %1. -rem pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 -echo Version was set to %1. -rem pause -call mvn versions:commit -Psamples,tests,dist -echo Version %1 committed. -rem pause - -echo Performing a short clean build. -rem pause -call mvn clean install -DperformRelease -echo Short clean build completed. -rem pause - -echo Performing a full clean build. -rem pause -call mvn clean install -Psamples,tests,dist -DperformRelease -echo Full clean build completed. -rem pause - -echo Checking in version %1. -rem pause -call mvn scm:checkin -Dmessage="Version %1" -echo Version %1 was checked in. -rem pause - -echo Tagging version %1. -rem pause -call mvn scm:tag -Dtag=%1 -echo Version %1 was tagged. -rem pause - -echo Performing full clean deploy. -rem pause -call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy -echo Full clean deploy done. -rem pause - -echo Setting new version to %2. -rem pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 -echo Version was set to %2. -rem pause -call mvn versions:commit -Psamples,tests,dist -echo Version %2 was committed. -rem pause - -echo Performing a short clean build. -rem pause -call mvn clean install -DperformRelease -rem pause - -echo Checking in version %2. -rem pause -call mvn scm:checkin -Dmessage="Version %2" -echo Version %2 was checked in. -rem pause - -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.2/release.bat b/basics/tags/0.8.2/release.bat deleted file mode 100644 index ca58cfd7..00000000 --- a/basics/tags/0.8.2/release.bat +++ /dev/null @@ -1,76 +0,0 @@ -setlocal -echo Setting JAVA_HOME to %JAVA6_HOME%. -set JAVA_HOME=%JAVA6_HOME% - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -DperformRelease -Psamples,tests,dist -echo Full clean build completed. -pause - -echo Setting new version to %1. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 -echo Version was set to %1. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %1 committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -Psamples,tests,dist -DperformRelease -echo Full clean build completed. -pause - -echo Checking in version %1. -pause -call mvn scm:checkin -Dmessage="Version %1" -echo Version %1 was checked in. -pause - -echo Tagging version %1. -pause -call mvn scm:tag -Dtag=%1 -echo Version %1 was tagged. -pause - -echo Performing full clean deploy. -pause -call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy -echo Full clean deploy done. -pause - -echo Setting new version to %2. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 -echo Version was set to %2. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %2 was committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -pause - -echo Checking in version %2. -pause -call mvn scm:checkin -Dmessage="Version %2" -echo Version %2 was checked in. -pause - -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.2/runtime/.classpath b/basics/tags/0.8.2/runtime/.classpath deleted file mode 100644 index 5d675fc8..00000000 --- a/basics/tags/0.8.2/runtime/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/runtime/.project b/basics/tags/0.8.2/runtime/.project deleted file mode 100644 index 5441da06..00000000 --- a/basics/tags/0.8.2/runtime/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.2/runtime/pom.xml b/basics/tags/0.8.2/runtime/pom.xml deleted file mode 100644 index 929ad853..00000000 --- a/basics/tags/0.8.2/runtime/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - 0.8.2 - jar - JAXB2 Basics - Runtime - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.2 - ../pom.xml - - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - provided - - - junit - junit - test - - - commons-io - commons-io - test - - - com.vividsolutions - jts - 1.8 - test - - - - install - - - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - - - bundle-manifest - process-classes - - manifest - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index d66a74b7..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,371 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else if (lhs instanceof Equals[]) { - return equalsInternal(leftLocator, rightLocator, (Equals[]) lhs, - (Equals[]) rhs); - } else if (lhs instanceof Enum[]) { - return equalsInternal(leftLocator, rightLocator, (Enum[]) lhs, - (Enum[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else if (lhs instanceof Enum) { - return equalsInternal(leftLocator, rightLocator, (Enum) lhs, (Enum) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum lhs, Enum rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals lhs, Equals rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - return lhs.equals(leftLocator, rightLocator, rhs, this); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals[] left, Equals[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum[] left, Enum[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index e54659cd..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else if (object instanceof HashCode[]) { - return hashCodeInternal(locator, hashCode, (HashCode[]) object); - } else if (object instanceof Enum[]) { - return hashCodeInternal(locator, hashCode, (Enum[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else if (value instanceof Enum) { - return hashCodeInternal(locator, hashCode, (Enum) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode object) { - if (object == null) { - return hashCode * iConstant; - } else { - return hashCode * iConstant + object.hashCode(locator, this); - } - } - - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java deleted file mode 100644 index 9e843b88..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public interface EnumValue { - - public T enumValue(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index a6c06704..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 88b3cce7..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - // Treat empty lists as nulls - if (list.isEmpty()) { - return super.hashCode(locator, hashCode, (Object) null); - } else { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 8407ab35..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - public String getPathAsString() { - final String stepAsString = getStepAsString(); - final ObjectLocator parentLocator = getParentLocator(); - return parentLocator == null ? stepAsString : parentLocator - .getPathAsString() + stepAsString; - } - - protected abstract String getStepAsString(); - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - - // public Object[] getMessageParameters() { - // return new Object[] { getObject() }; - // } - // - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() + ".messages")); - } - - // public int hashCode() { - // int hashCode = getObject().hashCode(); - // return hashCode; - // } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index ce0d32ff..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "[" + getIndex() + "]"; - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index 0484223a..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "." + getPropertyName(); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index ecd6fc3e..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return ""; - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 37aa8555..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * @return Path to this locator in string form; - */ - public String getPathAsString(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index 57cecb8e..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MClassTypeInfo, - MOriginated { - - public MClassTypeInfo getBaseTypeInfo(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java deleted file mode 100644 index 963d4734..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassRef extends MClassTypeInfo { -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java deleted file mode 100644 index fb396a97..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassTypeInfo extends MPackagedTypeInfo, - MContainer { - - public C getTargetClass(); - - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java deleted file mode 100644 index 47d7b23e..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassTypeInfoVisitor { - - public V visitClassInfo(MClassInfo info); - - public V visitClassRef(MClassRef info); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java deleted file mode 100644 index 73f92248..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContained { - - public MContainer getContainer(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java deleted file mode 100644 index e55cac10..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContainer extends MPackaged { - - public String getLocalName(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java deleted file mode 100644 index 1a673485..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomizable { - - public MCustomizations getCustomizations(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java deleted file mode 100644 index 3e32cc52..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomization { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java deleted file mode 100644 index b20537dc..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MCustomizations { - - public List getCustomizations(); - - public void addCustomization(MCustomization customization); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index 6c72d310..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated, MContained, MContainer { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java deleted file mode 100644 index 4a43b435..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MID extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java deleted file mode 100644 index 49ca1c30..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREF extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java deleted file mode 100644 index 1f0b2084..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREFS extends MList { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 9e0b5b8c..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MCustomizable, - MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 6ea7fe61..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated, - MContainer { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 7c7571b9..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged, - MContained { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index 0d628be5..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitID(MID info) { - return null; - } - - public V visitIDREF(MIDREF info) { - return null; - } - - public V visitIDREFS(MIDREFS info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 98a86bc7..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo extends MCustomizable { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 8b2d1e4b..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor extends - MClassTypeInfoVisitor { - - public V visitList(MList info); - - public V visitID(MID info); - - public V visitIDREF(MIDREF info); - - public V visitIDREFS(MIDREFS info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 6dd77b37..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - private final MCustomizations customizations = new CMCustomizations(); - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index bdc4a89a..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - private final MClassTypeInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MClassTypeInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getContainer(), getLocalName(), - getElementName(), scope, this, substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MContainer getScope() { - return container; - } - - public MClassTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } - - @Override - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java deleted file mode 100644 index a64ba452..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMClassRef implements MClassRef { - - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - - public CMClassRef(/* MClassInfoOrigin origin, */C targetClass, - MPackageInfo _package, MContainer container, String localName) { - super(); - // Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - // this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public T getTargetType() { - return targetClass; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassRef(this); - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public C getTargetClass() { - return targetClass; - } - - @Override - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor) { - return visitor.visitClassRef(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java deleted file mode 100644 index 6e09ab64..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.w3c.dom.Element; - -public class CMCustomization implements MCustomization { - - private final Element element; - - public CMCustomization(Element element) { - this.element = element; - } - - public Element getElement() { - return element; - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java deleted file mode 100644 index c7bfa857..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; - -public class CMCustomizations implements MCustomizations { - - private final List customizations = new LinkedList(); - private final List unmodifiableCustomizations = Collections - .unmodifiableList(this.customizations); - - public List getCustomizations() { - return unmodifiableCustomizations; - } - - public void addCustomization(MCustomization customization) { - Validate.notNull(customization); - this.customizations.add(customization); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index e539fd75..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final MContainer container; - - private final String localName; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - MContainer container, String localName, QName elementName, - MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.container = container; - this.localName = localName; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getLocalName() { - return localName; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index aa7c8693..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); -// Validate.notEmpty(elementTypeInfos); -// Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 47a598a2..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo, - MCustomizable { - - private final MEnumLeafInfoOrigin origin; - private final CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final MContainer container; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.container = container; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), - getContainer(), - getLocalName(), - getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java deleted file mode 100644 index 5daa634c..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMID implements MID { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMID(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitID(this); - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java deleted file mode 100644 index 2eaeacde..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMIDREF implements MIDREF { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMIDREF(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREF(this); - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java deleted file mode 100644 index accf9d52..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMIDREFS extends CMList implements MIDREFS { - - public CMIDREFS(T targetType, MTypeInfo itemTypeInfo) { - super(targetType, itemTypeInfo); - } - - @Override - public String toString() { - return MessageFormat.format("IDREFS [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREFS(this); - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index 8fecc6d6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,519 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - @SuppressWarnings("unchecked") - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - - Collection> beans = typeInfoSet.beans() - .values(); - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - return model; - - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - - if (list) { - switch (id) { - case ID: - final MTypeInfo tid = new CMID(ti.getTargetType(), - ti); - return new CMList(createListType(tid.getTargetType()), - tid); - case IDREF: - return new CMIDREFS(createListType(ti.getTargetType()), - ti); - default: - return new CMList(createListType(ti.getTargetType()), ti); - } - } else { - switch (id) { - case ID: - return new CMID(ti.getTargetType(), ti); - case IDREF: - return new CMIDREF(ti.getTargetType(), ti); - default: - return ti; - } - } - - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - MBuiltinLeafInfo builtinLeafInfo = builtinLeafInfos.get(typeInfo); - if (builtinLeafInfo == null) { - builtinLeafInfo = createBuiltinLeafInfo(typeInfo); - builtinLeafInfos.put(typeInfo, builtinLeafInfo); - return builtinLeafInfo; - } - return builtinLeafInfo; - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - - MClassInfo classInfo = classInfos.get(info); - - if (classInfo == null) { - - classInfo = createClassInfo(info); - classInfos.put(info, classInfo); - - if (info.hasAttributeWildcard()) { - classInfo - .addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - return classInfo; - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - MEnumLeafInfo enumLeafInfo = enumLeafInfos.get(info); - if (enumLeafInfo == null) { - enumLeafInfo = createEnumLeafInfo(info); - enumLeafInfos.put(info, enumLeafInfo); - - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - return enumLeafInfo; - - } - - protected MElementInfo getElementInfo(EI info) { - MElementInfo mElementInfo = elementInfos.get(info); - if (mElementInfo == null) { - mElementInfo = createElementInfo(info); - elementInfos.put(info, mElementInfo); - } - return mElementInfo; - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), createBaseTypeInfo(info), - info.isElement() ? info.getElementName() : null); - } - - protected MClassTypeInfo createBaseTypeInfo(CI info) { - return info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MClassInfo getScope(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract String getLocalName(EI info); - - protected abstract MPackageInfo getPackage(EI info); - - protected abstract MContainer getContainer(CI info); - - protected abstract MContainer getContainer(EI info); - - protected abstract MContainer getContainer(ELI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), getTypeInfo(baseType), - info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - getContainer(element), getLocalName(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 1e50748c..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index e3ee1ebd..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final CMCustomizations customizations = new CMCustomizations(); - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 85cc5a38..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - - public String getLocalName() { - return null; - } - - public String getContainerLocalName(String delimiter) { - return null; - } - - public MPackageInfo getPackageInfo() { - return this; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index 196a11bd..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo, - MCustomizable { - - private CMCustomizations customizations = new CMCustomizations(); - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index 5f9236b9..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - private final MCustomizations customizations = new CMCustomizations(); - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index c92e2e84..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitID(MID info) { - return visitTypeInfo(info); - } - - public V visitIDREF(MIDREF info) { - return visitTypeInfo(info); - } - - public V visitIDREFS(MIDREFS info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } - - public V visitClassRef(MClassRef info) { - return visitTypeInfo(info); - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java deleted file mode 100644 index 43c96d12..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -public class PackageInfoQNameAnalyzer { - - private final MModelInfo modelInfo; - - public PackageInfoQNameAnalyzer(MModelInfo modelInfo) { - Validate.notNull(modelInfo); - this.modelInfo = modelInfo; - } - - public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - counter.add(name.getNamespaceURI()); - } - - public void attribute(QName name) { - - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - } - - public void attribute(QName name) { - counter.add(name.getNamespaceURI()); - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - private void collectNamespaceURIs(MPackageInfo packageInfo, - final QNameCollector collector) { - for (MElementInfo elementInfo : modelInfo.getElementInfos()) { - if (elementInfo.getPackageInfo() == packageInfo) { - collector.element(elementInfo.getElementName()); - } - } - - final QNameCollectingPropertyInfoVisitor visitor = new QNameCollectingPropertyInfoVisitor( - collector); - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - if (classInfo.getPackageInfo() == packageInfo) { - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - propertyInfo.acceptPropertyInfoVisitor(visitor); - } - } - } - } - - private static class NamespaceURICounter { - private Map map = new HashMap(); - - public void add(String namespaceURI) { - final Integer count = map.get(namespaceURI); - if (count == null) { - map.put(namespaceURI, Integer.valueOf(1)); - } else { - map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); - } - } - - public String getMostUsedNamespaceURI() { - String namespaceURI = null; - int count = 0; - - for (Map.Entry e : map.entrySet()) { - final String currentNamespaceURI = e.getKey(); - final int currentCount = e.getValue(); - if (namespaceURI == null) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } else { - if (currentCount > count - || (currentCount == count && namespaceURI == null)) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } - } - } - - return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; - - } - - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java deleted file mode 100644 index 6729008e..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class QNameCollectingPropertyInfoVisitor implements - MPropertyInfoVisitor { - - private final QNameCollector collector; - - public QNameCollectingPropertyInfoVisitor(QNameCollector collector) { - Validate.notNull(collector); - this.collector = collector; - } - - public Void visitElementPropertyInfo(MElementPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementsPropertyInfo(MElementsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } - - public Void visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return null; - } - - public Void visitAttributePropertyInfo(MAttributePropertyInfo info) { - collector.attribute(info.getAttributeName()); - return null; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - return null; - } - - public Void visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java deleted file mode 100644 index 2bd50907..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -public interface QNameCollector { - - public void element(QName name); - - public void attribute(QName name); -} diff --git a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/tags/0.8.2/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/tags/0.8.2/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/tags/0.8.2/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/tags/0.8.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/tags/0.8.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/tags/0.8.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/tags/0.8.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/tags/0.8.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/tags/0.8.2/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/tags/0.8.2/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/tags/0.8.2/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/tags/0.8.2/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/basic/pom.xml b/basics/tags/0.8.2/samples/basic/pom.xml deleted file mode 100644 index 888f9b4c..00000000 --- a/basics/tags/0.8.2/samples/basic/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic - pom - JAXB2 Basics - Sample [basic] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.8.2 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/basic/project-build.xml b/basics/tags/0.8.2/samples/basic/project-build.xml deleted file mode 100644 index 05001052..00000000 --- a/basics/tags/0.8.2/samples/basic/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/basic/project-pom.xml b/basics/tags/0.8.2/samples/basic/project-pom.xml deleted file mode 100644 index 2909b2d1..00000000 --- a/basics/tags/0.8.2/samples/basic/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/basic/src/main/assembly/src.xml b/basics/tags/0.8.2/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/tags/0.8.2/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/tags/0.8.2/samples/basic/src/main/java/.placeholder b/basics/tags/0.8.2/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.2/samples/basic/src/main/resources/schema.xsd b/basics/tags/0.8.2/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.8.2/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.8.2/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.2/samples/basic/src/test/resources/log4j.properties b/basics/tags/0.8.2/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.2/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/basic/src/test/samples/1.xml b/basics/tags/0.8.2/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.2/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.2/samples/modular-ant/pom.xml b/basics/tags/0.8.2/samples/modular-ant/pom.xml deleted file mode 100644 index 6cc2d576..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4-SNAPSHOT - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/modular-ant/project-build.xml b/basics/tags/0.8.2/samples/modular-ant/project-build.xml deleted file mode 100644 index a2fc3e3a..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/modular-ant/src/main/assembly/src.xml b/basics/tags/0.8.2/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/tags/0.8.2/samples/modular-ant/src/main/java/.placeholder b/basics/tags/0.8.2/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.2/samples/modular-ant/src/main/resources/schema.xsd b/basics/tags/0.8.2/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.2/samples/modular-ant/src/test/resources/log4j.properties b/basics/tags/0.8.2/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/modular-ant/src/test/samples/1.xml b/basics/tags/0.8.2/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.2/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.2/samples/po/pom.xml b/basics/tags/0.8.2/samples/po/pom.xml deleted file mode 100644 index a2825bfa..00000000 --- a/basics/tags/0.8.2/samples/po/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po - pom - JAXB2 Basics - Sample [po] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.8.2 - ../pom.xml - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - com.sun.xml.bind - jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - maven-assembly - package - - - ant-assembly - package - - - - - maven-antrun-plugin - - - maven-unpack - pre-integration-test - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - maven-invoker-plugin - - - maven-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/po/project-build.xml b/basics/tags/0.8.2/samples/po/project-build.xml deleted file mode 100644 index 4523094a..00000000 --- a/basics/tags/0.8.2/samples/po/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/po/project-pom.xml b/basics/tags/0.8.2/samples/po/project-pom.xml deleted file mode 100644 index edf3ced9..00000000 --- a/basics/tags/0.8.2/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/po/src/main/java/.placeholder b/basics/tags/0.8.2/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/tags/0.8.2/samples/po/src/main/resources/bindings.xjb b/basics/tags/0.8.2/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/tags/0.8.2/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/tags/0.8.2/samples/po/src/main/resources/purchaseorder.xsd b/basics/tags/0.8.2/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/tags/0.8.2/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/tags/0.8.2/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.2/samples/po/src/test/resources/log4j.properties b/basics/tags/0.8.2/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.2/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/po/src/test/samples/po.xml b/basics/tags/0.8.2/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/tags/0.8.2/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/pom.xml b/basics/tags/0.8.2/samples/pom.xml deleted file mode 100644 index 68057bdc..00000000 --- a/basics/tags/0.8.2/samples/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-samples - pom - JAXB2 Basics - Samples - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.2 - ../pom.xml - - - po - basic - - - install - - - maven-assembly-plugin - true - - - maven-assembly - - none - - attached - - - - ../src/main/assembly/maven-src.xml - - - - - ant-assembly - - none - - attached - - - - ../src/main/assembly/ant-src.xml - - - - - - - maven-antrun-plugin - true - - - maven-unpack - - none - - - - - - - - run - - - - ant-unpack - - none - - - - - - - run - - - - ant-integration-test - - none - - - - - - - run - - - - - - maven-invoker-plugin - true - - - maven-integration-test - - none - - run - - - true - ${basedir}/target/test-maven-assembly - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/samples/src/main/assembly/ant-src.xml b/basics/tags/0.8.2/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/tags/0.8.2/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/tags/0.8.2/samples/src/main/assembly/maven-src.xml b/basics/tags/0.8.2/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/tags/0.8.2/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/tags/0.8.2/testing/.classpath b/basics/tags/0.8.2/testing/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.2/testing/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/testing/.project b/basics/tags/0.8.2/testing/.project deleted file mode 100644 index 4ead1953..00000000 --- a/basics/tags/0.8.2/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.2/testing/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.2/testing/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a8..00000000 --- a/basics/tags/0.8.2/testing/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.2/testing/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.2/testing/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.2/testing/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.2/testing/pom.xml b/basics/tags/0.8.2/testing/pom.xml deleted file mode 100644 index 7e9e4b5d..00000000 --- a/basics/tags/0.8.2/testing/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-testing - jar - JAXB2 Basics - Testing - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.2 - ../pom.xml - - - - xmlunit - xmlunit - compile - - - junit - junit - compile - - - commons-io - commons-io - - - org.jvnet.jaxb2_commons - jaxb2-basics-tools - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - javax.xml.bind - jaxb-api - provided - - - com.sun.xml.bind - jaxb-impl - test - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.2/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/tags/0.8.2/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/tags/0.8.2/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/tags/0.8.2/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/tags/0.8.2/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/tags/0.8.2/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/tags/0.8.2/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/tags/0.8.2/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/tags/0.8.2/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/tags/0.8.2/testing/src/test/samples/1.xml b/basics/tags/0.8.2/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/tags/0.8.2/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.8.2/testing/src/test/samples/2.xml b/basics/tags/0.8.2/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/tags/0.8.2/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/build-1.5.bat b/basics/tags/0.8.2/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/tags/0.8.2/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/build-1.6.bat b/basics/tags/0.8.2/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/tags/0.8.2/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/episodes/a/pom.xml b/basics/tags/0.8.2/tests/episodes/a/pom.xml deleted file mode 100644 index be3121d2..00000000 --- a/basics/tags/0.8.2/tests/episodes/a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.8.2 - ../pom.xml - - jaxb2-basics-test-episodes-a - jar - JAXB2 Basics - Test [episodes-a] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/episodes/a/src/main/resources/a.xsd b/basics/tags/0.8.2/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.8.2/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/episodes/a/src/main/resources/binding.xjb b/basics/tags/0.8.2/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/tags/0.8.2/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/tags/0.8.2/tests/episodes/a/src/test/samples/1.xml b/basics/tags/0.8.2/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/tags/0.8.2/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/episodes/b/pom.xml b/basics/tags/0.8.2/tests/episodes/b/pom.xml deleted file mode 100644 index 1bd9aa0a..00000000 --- a/basics/tags/0.8.2/tests/episodes/b/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes - 0.8.2 - ../pom.xml - - jaxb2-basics-test-episodes-b - jar - JAXB2 Basics - Test [episodes-b] - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - ${project.version} - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - org.jvnet.jaxb2_commons - jaxb2-basics-test-episodes-a - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/episodes/b/src/main/resources/a.xsd b/basics/tags/0.8.2/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/tags/0.8.2/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/episodes/b/src/main/resources/b.xsd b/basics/tags/0.8.2/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/tags/0.8.2/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/episodes/b/src/main/resources/binding.xjb b/basics/tags/0.8.2/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/tags/0.8.2/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/tags/0.8.2/tests/episodes/b/src/test/samples/1.xml b/basics/tags/0.8.2/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/tags/0.8.2/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/episodes/pom.xml b/basics/tags/0.8.2/tests/episodes/pom.xml deleted file mode 100644 index 5f467e62..00000000 --- a/basics/tags/0.8.2/tests/episodes/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.2 - ../pom.xml - - jaxb2-basics-test-episodes - pom - JAXB2 Basics - Test [episodes] - - a - b - - - test - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/ignoring/pom.xml b/basics/tags/0.8.2/tests/ignoring/pom.xml deleted file mode 100644 index 9cc7e4ad..00000000 --- a/basics/tags/0.8.2/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.2/tests/ignoring/src/main/resources/schema.xsd b/basics/tags/0.8.2/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/tags/0.8.2/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/issues/.classpath b/basics/tags/0.8.2/tests/issues/.classpath deleted file mode 100644 index b936c996..00000000 --- a/basics/tags/0.8.2/tests/issues/.classpath +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/tests/issues/.project b/basics/tags/0.8.2/tests/issues/.project deleted file mode 100644 index e6e2d74a..00000000 --- a/basics/tags/0.8.2/tests/issues/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.2/tests/issues/pom.xml b/basics/tags/0.8.2/tests/issues/pom.xml deleted file mode 100644 index a4e0ce1f..00000000 --- a/basics/tags/0.8.2/tests/issues/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.2 - ../pom.xml - - jaxb2-basics-test-issues - jar - JAXB2 Basics - Test [issues] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -Xequals-equalsStrategyClass=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB42EqualsStrategy - -XhashCode - -Xcopyable - -Xmergeable - -Xmergeable-mergeStrategyClass=org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy - -Xinheritance - -Xsetters - -Xsetters-mode=direct - -Xwildcard - -XautoInheritance - -XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne - -XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree - -XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour - -Xsimplify - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java deleted file mode 100644 index 77921c47..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { - - @Override - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { - // Quasi custom equals - return super.equals(leftLocator, rightLocator, lhs, rhs); - } else { - return super.equals(leftLocator, rightLocator, lhs, rhs); - } - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java b/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java deleted file mode 100644 index ff1fb59f..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB48Interface { - - public T getValue(); - -} diff --git a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java b/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java deleted file mode 100644 index 25d45a45..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB53ABaseClass { - -} diff --git a/basics/tags/0.8.2/tests/issues/src/main/resources/binding.xjb b/basics/tags/0.8.2/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 947ed1a4..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,18 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - diff --git a/basics/tags/0.8.2/tests/issues/src/main/resources/schema.xsd b/basics/tags/0.8.2/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 64b983aa..00000000 --- a/basics/tags/0.8.2/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB48Interface<java.lang.String> - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53ABaseClass - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53AType - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java deleted file mode 100644 index 746bc3b7..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB20Test extends TestCase { - - public void testException() throws Exception { - - final List strings = Arrays.asList("a", "b", "c"); - final IssueJIIB20 one = new IssueJIIB20(); - one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); - - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java deleted file mode 100644 index 01ba2358..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB44Test extends TestCase { - - private JAXBContext context; - - @Override - protected void setUp() throws Exception { - context = JAXBContext.newInstance(getClass().getPackage().getName()); - } - - public void testReferencesPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_0.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testReferencesPropertyAsReferencePropertyType() - throws Exception { - - IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_1.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testElementsPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_2.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getString().size()); - Assert.assertEquals(3, value.getInt().size()); - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 2ea29226..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); -// args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xsetters-mode=direct"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); - args.add("-Xannotate"); - args.add("-Xsimplify"); - return args; - } - -} diff --git a/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml deleted file mode 100644 index 0915dfad..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml deleted file mode 100644 index b811fb9b..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml deleted file mode 100644 index 0008e3ee..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - a - b - 0 - c - 1 - 2 - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/issues/src/test/samples/issue16[0].xml b/basics/tags/0.8.2/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/tags/0.8.2/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/one/.classpath b/basics/tags/0.8.2/tests/one/.classpath deleted file mode 100644 index 95482320..00000000 --- a/basics/tags/0.8.2/tests/one/.classpath +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/tests/one/.project b/basics/tags/0.8.2/tests/one/.project deleted file mode 100644 index 855cd8c9..00000000 --- a/basics/tags/0.8.2/tests/one/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.2/tests/one/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.2/tests/one/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 90d24a88..00000000 --- a/basics/tags/0.8.2/tests/one/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding//target/generated-sources/xjc=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.2/tests/one/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.2/tests/one/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.2/tests/one/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.2/tests/one/pom.xml b/basics/tags/0.8.2/tests/one/pom.xml deleted file mode 100644 index 04a565ee..00000000 --- a/basics/tags/0.8.2/tests/one/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.2 - - jaxb2-basics-test-one - jar - JAXB2 Basics - Test [one] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.2/tests/one/src/main/resources/binding.xjb b/basics/tags/0.8.2/tests/one/src/main/resources/binding.xjb deleted file mode 100644 index 3888abb4..00000000 --- a/basics/tags/0.8.2/tests/one/src/main/resources/binding.xjb +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/tests/one/src/main/resources/schema.xsd b/basics/tags/0.8.2/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index e527b565..00000000 --- a/basics/tags/0.8.2/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/tags/0.8.2/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/tags/0.8.2/tests/one/src/test/resources/log4j.properties b/basics/tags/0.8.2/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.2/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/one/src/test/samples/1.xml b/basics/tags/0.8.2/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/tags/0.8.2/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/tags/0.8.2/tests/one/src/test/samples/2.xml b/basics/tags/0.8.2/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/tags/0.8.2/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/tags/0.8.2/tests/pom.xml b/basics/tags/0.8.2/tests/pom.xml deleted file mode 100644 index 05297e0c..00000000 --- a/basics/tags/0.8.2/tests/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tests - pom - JAXB2 Basics - Tests - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.2 - ../pom.xml - - - episodes - one - issues - zj - - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - test - - - - test - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - generate - - generate - - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/wildcard/.classpath b/basics/tags/0.8.2/tests/wildcard/.classpath deleted file mode 100644 index b936c996..00000000 --- a/basics/tags/0.8.2/tests/wildcard/.classpath +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/tests/wildcard/.project b/basics/tags/0.8.2/tests/wildcard/.project deleted file mode 100644 index 0636b2c4..00000000 --- a/basics/tags/0.8.2/tests/wildcard/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-wildcard - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.2/tests/wildcard/.settings/org.eclipse.core.resources.prefs b/basics/tags/0.8.2/tests/wildcard/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index dd79ee7b..00000000 --- a/basics/tags/0.8.2/tests/wildcard/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding//target/generated-sources/xjc=UTF-8 -encoding/=UTF-8 diff --git a/basics/tags/0.8.2/tests/wildcard/.settings/org.eclipse.jdt.core.prefs b/basics/tags/0.8.2/tests/wildcard/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/tags/0.8.2/tests/wildcard/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.2/tests/wildcard/pom.xml b/basics/tags/0.8.2/tests/wildcard/pom.xml deleted file mode 100644 index dcb22a75..00000000 --- a/basics/tags/0.8.2/tests/wildcard/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-wildcard - jar - JAXB2 Basics - Test [wildcard] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xwildcard - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.2/tests/wildcard/src/main/resources/binding.xjb b/basics/tags/0.8.2/tests/wildcard/src/main/resources/binding.xjb deleted file mode 100644 index 8f780f74..00000000 --- a/basics/tags/0.8.2/tests/wildcard/src/main/resources/binding.xjb +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/basics/tags/0.8.2/tests/wildcard/src/main/resources/schema.xsd b/basics/tags/0.8.2/tests/wildcard/src/main/resources/schema.xsd deleted file mode 100644 index 7d520ce9..00000000 --- a/basics/tags/0.8.2/tests/wildcard/src/main/resources/schema.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/zj/pom.xml b/basics/tags/0.8.2/tests/zj/pom.xml deleted file mode 100644 index 2324eee7..00000000 --- a/basics/tags/0.8.2/tests/zj/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.8.2 - ../pom.xml - - jaxb2-basics-test-zj - jar - JAXB2 Basics - Test [zj] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/tags/0.8.2/tests/zj/src/main/resources/ObisData.xsd b/basics/tags/0.8.2/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/tags/0.8.2/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/tags/0.8.2/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/tags/0.8.2/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/tags/0.8.2/tests/zj/src/test/resources/log4j.properties b/basics/tags/0.8.2/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/tags/0.8.2/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/tags/0.8.2/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/tags/0.8.2/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/tags/0.8.2/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/tags/0.8.2/tools/.classpath b/basics/tags/0.8.2/tools/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/tags/0.8.2/tools/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/tags/0.8.2/tools/.project b/basics/tags/0.8.2/tools/.project deleted file mode 100644 index e7b0094b..00000000 --- a/basics/tags/0.8.2/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/tags/0.8.2/tools/pom.xml b/basics/tags/0.8.2/tools/pom.xml deleted file mode 100644 index 60a73044..00000000 --- a/basics/tags/0.8.2/tools/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-tools - 0.8.2 - jar - JAXB2 Basics - Tools - - org.jvnet.jaxb2_commons - jaxb2-basics-project - 0.8.2 - ../pom.xml - - - - commons-beanutils - commons-beanutils - - - org.apache.commons - commons-lang3 - - - commons-logging - commons-logging - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - - - com.sun.xml.bind - jaxb-impl - provided - - - com.sun.xml.bind - jaxb-xjc - provided - - - org.springframework - spring - provided - - - - install - - \ No newline at end of file diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index f67cc957..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!(namespaceURI== null || namespaceURI.length() == 0)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d3644156..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 176d5a2c..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,654 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(Outline outline, QName name) { - final CPluginCustomization customization = findCustomization(outline, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(Model model, QName name) { - final CPluginCustomization customization = findCustomization(model, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(EnumOutline enumOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - enumOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - Outline outline, QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CEnumLeafInfo enumLeafInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - enumLeafInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Outline outline, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(outline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Outline outline) { - return getCustomizations(outline.getModel()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index c65295d2..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public boolean isAlwaysSet() { - if (constantField != null) { - return true; - } else { - return JExpr.TRUE == fieldAccessor.hasSetValue(); - } - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - if (isAlwaysSet()) { - block.assign($var, targetObject.invoke(getter)); - } else { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index cb6e5928..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(final MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = classInfo - .getBaseTypeInfo() - .acceptClassTypeInfoVisitor( - new MClassTypeInfoVisitor() { - @Override - public MClassOutline visitClassInfo( - MClassInfo info) { - return parent.getParent().getClassOutline( - info); - } - - @Override - public MClassOutline visitClassRef( - MClassRef info) { - return null; - } - }); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 15e216be..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 8178879e..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 0e5b4ec1..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index bb384e2f..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(final CMModelOutline modelOutline, - final MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - classInfo.getBaseTypeInfo().acceptClassTypeInfoVisitor( - new MClassTypeInfoVisitor() { - @Override - public Void visitClassInfo( - MClassInfo info) { - generateClassOutline(modelOutline, modelInfo, info); - return null; - } - - @Override - public Void visitClassRef(MClassRef info) { - return null; - } - }); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index b045735f..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index 344bc3f7..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 656f8d82..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,394 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - private final Map> classRefs = - - new IdentityHashMap>(); - - public XJCCMInfoFactory(Model model) { - super(model); - } - - protected NClass getClazz(CClassRef info) { - return info; - } - - protected NClass getClazz(final Class _clas) { - return new NClass() { - - @Override - public boolean isBoxedType() { - return false; - } - - @Override - public String fullName() { - return _clas.getName(); - } - - @Override - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(_clas); - } - - @Override - public boolean isAbstract() { - return false; - } - }; - } - - protected NClass getClazz(final String className) { - return new NClass() { - - @Override - public boolean isBoxedType() { - return false; - } - - @Override - public String fullName() { - return className; - } - - @Override - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(className); - } - - @Override - public boolean isAbstract() { - return false; - } - }; - } - - protected MClassRef createClassRef(Class _class) { - return new CMClassRef(getClazz(_class), - getPackage(_class), getContainer(_class), getLocalName(_class)); - } - - protected MClassRef getTypeInfo(CClassRef info) { - - MClassRef classInfo = classRefs.get(info); - - if (classInfo == null) { - - classInfo = createClassRef(info); - classRefs.put(info, classInfo); - } - return classInfo; - } - - protected MClassRef createClassRef(CClassRef info) { - return new CMClassRef(getClazz(info), getPackage(info), - getContainer(info), getLocalName(info)); - } - - @Override - protected MTypeInfo getTypeInfo(CTypeInfo typeInfo) { - if (typeInfo instanceof CClassRef) { - return getTypeInfo((CClassRef) typeInfo); - } else { - return super.getTypeInfo(typeInfo); - } - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - protected MPackageInfo getPackage(CClassRef info) { - final String fullName = info.fullName(); - return getPackage(fullName); - } - - private MPackageInfo getPackage(final String fullName) { - try { - final Class _class = Class.forName(fullName); - return getPackage(_class); - } catch (ClassNotFoundException cnfex) { - final String packageName; - final int lastIndexOfDot = fullName.lastIndexOf('.'); - if (lastIndexOfDot != -1) { - packageName = fullName.substring(0, lastIndexOfDot); - } else { - packageName = ""; - } - return new CMPackageInfo(new CMPackageInfoOrigin(), packageName); - } - } - - private MPackageInfo getPackage(final Class _class) { - final Package _package = _class.getPackage(); - return new CMPackageInfo(new CMPackageInfoOrigin(), _package.getName()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - @Override - protected MContainer getContainer(CClassInfo info) { - final CClassInfoParent parent = info.parent(); - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CElementInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CEnumLeafInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - protected MContainer getContainer(CClassRef info) { - final String fullName = info.fullName(); - try { - final Class _class = Class.forName(fullName); - return getContainer(_class); - } catch (ClassNotFoundException cnfex) { - return getPackage(info); - } - } - - private MContainer getContainer(final Class _class) { - final Class enclosingClass = _class.getEnclosingClass(); - if (enclosingClass == null) { - return getPackage(_class); - } else { - return createClassRef(enclosingClass); - } - } - - private final Map packages = new HashMap(); - - private MContainer getContainer(CClassInfoParent parent) { - return parent.accept(new Visitor() { - - public MContainer onBean(CClassInfo bean) { - return getTypeInfo(bean); - } - - public MContainer onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MContainer onElement(CElementInfo element) { - return getElementInfo(element); - } - }); - } - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected MClassInfo getScope(CClassInfo info) { - return info.getScope() == null ? null : getTypeInfo(info.getScope()); - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - protected String getLocalName(CClassRef info) { - final String fullName = info.fullName(); - try { - final Class _class = Class.forName(fullName); - return getLocalName(_class); - } catch (ClassNotFoundException cnfex) { - return getLocalName(fullName); - } - } - - private String getLocalName(final String fullName) { - final int lastIndexOfDollar = fullName.lastIndexOf('$'); - if (lastIndexOfDollar != -1) { - return fullName.substring(lastIndexOfDollar + 1); - } - final int lastIndexOfDot = fullName.lastIndexOf('.'); - if (lastIndexOfDot != -1) { - return fullName.substring(lastIndexOfDot + 1); - } - return fullName; - } - - private String getLocalName(final Class _class) { - return _class.getSimpleName(); - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CElementInfo info) { - return info.shortName(); - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } - - private MPackageInfo getPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - @Override - protected MClassTypeInfo createBaseTypeInfo(CClassInfo info) { - if (info.getBaseClass() != null) { - return getTypeInfo(info.getBaseClass()); - } else if (info.getRefBaseClass() != null) { - return getTypeInfo(info.getRefBaseClass()); - } else { - return null; - } - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 28ed69a4..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index 51ee09b5..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); - - public boolean isAlwaysSet(); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index e977655d..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 033acf34..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 369c9768..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index d89918aa..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 11444b09..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index 96e82667..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index 85bd7b16..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index 67a576c1..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 41c9d885..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 74b7bd87..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index be5334e4..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index f4f9e307..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c8b7f118..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 91362018..00000000 --- a/basics/tags/0.8.2/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/basics/trunk/ant/.classpath b/basics/trunk/ant/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/trunk/ant/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/trunk/ant/.project b/basics/trunk/ant/.project deleted file mode 100644 index 63b92b0b..00000000 --- a/basics/trunk/ant/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-ant - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/trunk/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java b/basics/trunk/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java deleted file mode 100644 index 9142eb0f..00000000 --- a/basics/trunk/ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; - -public class XJC2Task extends com.sun.tools.xjc.XJC2Task { - - @Override - public void execute() throws BuildException { - - hack(); - super.execute(); - } - - protected void hack() { - try { - final Field declaredField = getClass().getSuperclass() - .getDeclaredField("classpath"); - declaredField.setAccessible(true); - final Path path = (Path) declaredField.get(this); - if (path != null) { - for (String pathElement : path.list()) { - options.classpaths.add(new File(pathElement).toURI() - .toURL()); - } - } - } catch (Exception ex) { - throw new BuildException(ex); - } - } -} diff --git a/basics/trunk/basic/.classpath b/basics/trunk/basic/.classpath deleted file mode 100644 index 5d675fc8..00000000 --- a/basics/trunk/basic/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/trunk/basic/.project b/basics/trunk/basic/.project deleted file mode 100644 index 9ef5e932..00000000 --- a/basics/trunk/basic/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java deleted file mode 100644 index bf38fb75..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Customizations.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic"; - - public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "generated"); - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java deleted file mode 100644 index 176f243b..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/CustomizedIgnoring.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CustomizedIgnoring implements Ignoring { - - private final QName[] ignoredCustomizationElementNames; - - public CustomizedIgnoring(QName... names) { - this.ignoredCustomizationElementNames = names; - } - - public QName[] getIgnoredCustomizationElementNames() { - return ignoredCustomizationElementNames; - } - - public boolean isIgnored(ClassOutline classOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(EnumOutline enumOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(FieldOutline fieldOutline) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(fieldOutline, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CClassInfo classInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(classInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) { - return true; - } - } - return false; - } - - public boolean isIgnored(CPropertyInfo propertyInfo) { - for (QName name : getIgnoredCustomizationElementNames()) { - if (CustomizationUtils.containsCustomization(propertyInfo, name)) { - return true; - } - } - return false; - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java deleted file mode 100644 index 0d007353..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface Ignoring { - - public boolean isIgnored(ClassOutline classOutline); - - public boolean isIgnored(EnumOutline enumOutline); - - public boolean isIgnored(FieldOutline fieldOutline); - - public boolean isIgnored(CClassInfo classInfo); - - public boolean isIgnored(CEnumLeafInfo enumLeafInfo); - - public boolean isIgnored(CPropertyInfo propertyInfo); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java deleted file mode 100644 index f2b0d7ae..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/autoinheritance/AutoInheritancePlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.autoinheritance; - -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class AutoInheritancePlugin extends AbstractParameterizablePlugin { - - private String xmlRootElementsExtend = null; - private List xmlRootElementsImplement = new LinkedList(); - - private String xmlTypesExtend = null; - private List xmlTypesImplement = new LinkedList(); - - private List jaxbElementsImplement = new LinkedList(); - - public String getXmlRootElementsExtend() { - return xmlRootElementsExtend; - } - - public void setXmlRootElementsExtend(String globalElementsExtend) { - this.xmlRootElementsExtend = globalElementsExtend; - } - - public String getXmlRootElementsImplement() { - return xmlRootElementsImplement.toString(); - } - - public void setXmlRootElementsImplement(String xmlRootElementsImplement) { - this.xmlRootElementsImplement.add(xmlRootElementsImplement); - } - - public String getXmlTypesExtend() { - return xmlTypesExtend; - } - - public void setXmlTypesExtend(String globalComplexTypesExtend) { - this.xmlTypesExtend = globalComplexTypesExtend; - } - - public String getXmlTypesImplement() { - return xmlTypesImplement.toString(); - } - - public void setXmlTypesImplement(String xmlTypesImplement) { - this.xmlTypesImplement.add(xmlTypesImplement); - } - - public String getJaxbElementsImplement() { - return jaxbElementsImplement.toString(); - } - - public void setJaxbElementsImplement(String jaxbElementsImplement) { - this.jaxbElementsImplement.add(jaxbElementsImplement); - } - - @Override - public String getOptionName() { - return "XautoInheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (classOutline.target.getElementName() != null) { - processGlobalElement(classOutline); - } else { - processGlobalComplexType(classOutline); - } - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processGlobalJAXBElement(elementOutline); - } - } - return true; - } - - protected void processGlobalElement(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlRootElementsExtend); - generateImplements(classOutline.implClass, xmlRootElementsImplement); - - } - - protected void processGlobalJAXBElement(ElementOutline elementOutline) { - - generateImplements(elementOutline.implClass, jaxbElementsImplement); - - } - - protected void processGlobalComplexType(ClassOutline classOutline) { - - generateExtends(classOutline.implClass, xmlTypesExtend); - generateImplements(classOutline.implClass, xmlTypesImplement); - - } - - private void generateExtends(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - if (theClass._extends() == theClass.owner().ref(Object.class)) { - theClass._extends(targetClass); - } - } - } - - private void generateImplements(JDefinedClass theClass, String name) { - if (name != null) { - final JClass targetClass = theClass.owner().ref(name); - theClass._implements(targetClass); - } - } - - private void generateImplements(JDefinedClass theClass, List names) { - if (names != null && !names.isEmpty()) { - for (String name : names) { - generateImplements(theClass, name); - } - } - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java deleted file mode 100644 index ca56dce8..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/CopyablePlugin.java +++ /dev/null @@ -1,335 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CopyablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xcopyable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String copyStrategyClass = JAXBCopyStrategy.class.getName(); - - public void setCopyStrategyClass(final String copyStrategy) { - this.copyStrategyClass = copyStrategy; - } - - public String getCopyStrategyClass() { - return copyStrategyClass; - } - - public JExpression createCopyStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - CopyStrategy.class, getCopyStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.copyable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - ClassUtils._implements(theClass, theClass.owner().ref(Cloneable.class)); - @SuppressWarnings("unused") - final JMethod object$clone = generateObject$clone(classOutline, - theClass); - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - @SuppressWarnings("unused") - final JMethod copyTo$copyTo = generateCopyTo$copyTo(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod copyTo$copyTo1 = generateCopyTo$copyTo1(classOutline, - theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo = generateCopyable$CopyTo(classOutline, - // theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyTo1 = - // generateCopyable$CopyTo1(classOutline, - // theClass); - - // @SuppressWarnings("unused") - // final JMethod copyFrom$copyFrom = generateCopyFrom$CopyFrom( - // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod copyable$copyFrom = generateCopyable$CopyFrom( - // classOutline, theClass); - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateCopyTo$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateCopyTo$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } - - protected JMethod generateObject$clone(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JMethod clone = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "clone"); - { - final JBlock body = clone.body(); - body._return(JExpr.invoke("copyTo").arg( - JExpr.invoke("createNewInstance"))); - } - return clone; - } - - protected JMethod generateCopyTo$copyTo(final ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod copyTo$copyTo = theClass.method(JMod.PUBLIC, - codeModel.ref(Object.class), "copyTo"); - { - final JVar target = copyTo$copyTo.param(Object.class, "target"); - - final JBlock body = copyTo$copyTo.body(); - final JVar copyStrategy = body.decl(JMod.FINAL, - codeModel.ref(CopyStrategy.class), "strategy", - createCopyStrategy(codeModel)); - - body._return(JExpr.invoke("copyTo").arg(JExpr._null()).arg(target) - .arg(copyStrategy)); - } - return copyTo$copyTo; - } - - protected JMethod generateCopyTo$copyTo1(ClassOutline classOutline, - final JDefinedClass theClass) { - ClassUtils._implements(theClass, theClass.owner().ref(CopyTo.class)); - - final JMethod copyTo = theClass.method(JMod.PUBLIC, theClass.owner() - .ref(Object.class), "copyTo"); - { - final JVar locator = copyTo.param(ObjectLocator.class, "locator"); - final JVar target = copyTo.param(Object.class, "target"); - final JVar copyStrategy = copyTo.param(CopyStrategy.class, - "strategy"); - - final JBlock body = copyTo.body(); - - final JVar draftCopy; - if (!classOutline.target.isAbstract()) { - draftCopy = body.decl( - JMod.FINAL, - theClass.owner().ref(Object.class), - "draftCopy", - - JOp.cond(JOp.eq(target, JExpr._null()), - JExpr.invoke("createNewInstance"), target)); - } else { - body._if(JExpr._null().eq(target)) - ._then() - ._throw(JExpr - ._new(theClass.owner().ref( - IllegalArgumentException.class)) - .arg("Target argument must not be null for abstract copyable classes.")); - draftCopy = target; - } - - Boolean superClassImplementsCopyTo = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - CopyTo.class); - - if (superClassImplementsCopyTo == null) { - - } else if (superClassImplementsCopyTo.booleanValue()) { - body.invoke(JExpr._super(), "copyTo").arg(locator) - .arg(draftCopy).arg(copyStrategy); - - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock bl = body._if(draftCopy._instanceof(theClass)) - ._then(); - - final JVar copy = bl.decl(JMod.FINAL, theClass, "copy", - JExpr.cast(theClass, draftCopy)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx sourceFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final FieldAccessorEx copyFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, copy); - - if (sourceFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = bl.block(); - - final JBlock setValueBlock; - final JBlock unsetValueBlock; - - final JExpression valueIsSet = sourceFieldAccessor - .hasSetValue(); - - if (!sourceFieldAccessor.isAlwaysSet() - && valueIsSet != null) { - final JConditional ifValueIsSet = block._if(valueIsSet); - setValueBlock = ifValueIsSet._then(); - unsetValueBlock = ifValueIsSet._else(); - } else { - setValueBlock = block; - unsetValueBlock = null; - } - - if (setValueBlock != null) { - - final JType copyFieldType = sourceFieldAccessor - .getType(); - final JVar sourceField = setValueBlock.decl( - copyFieldType, "source" - + fieldOutline.getPropertyInfo() - .getName(true)); - sourceFieldAccessor.toRawValue(setValueBlock, - sourceField); - final JExpression builtCopy = JExpr - .invoke(copyStrategy, "copy") - .arg(theClass - .owner() - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(sourceField)).arg(sourceField); - final JVar copyField = setValueBlock.decl( - copyFieldType, "copy" - + fieldOutline.getPropertyInfo() - .getName(true), - copyFieldType.isPrimitive() ? builtCopy : - - JExpr.cast(copyFieldType, builtCopy)); - if (copyFieldType instanceof JClass - && ((JClass) copyFieldType).isParameterized()) { - copyField.annotate(SuppressWarnings.class).param( - "value", "unchecked"); - } - copyFieldAccessor.fromRawValue(setValueBlock, "unique" - + fieldOutline.getPropertyInfo().getName(true), - copyField); - } - if (unsetValueBlock != null) { - copyFieldAccessor.unsetValues(unsetValueBlock); - - } - } - } - - body._return(draftCopy); - } - return copyTo; - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java deleted file mode 100644 index 63f046a3..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/copyable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/copyable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java deleted file mode 100644 index 5f011bed..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/elementWrapper"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java deleted file mode 100644 index 60a52b80..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.elementwrapper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.model.AbstractModelPlugin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.DummyPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.util.DefaultTypeInfoVisitor; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class ElementWrapperPlugin extends AbstractModelPlugin { - - @Override - public String getOptionName() { - return "XelementWrapper"; - } - - @Override - public String getUsage() { - return "Generates @XmlElementWrapper annotations."; - } - - @Override - protected void postProcessModel(Model model, - final MModelInfo mmodel, ErrorHandler errorHandler) { - - final Collection> classInfos = new ArrayList>( - mmodel.getClassInfos()); - for (final MClassInfo rootClassInfo : classInfos) { - if (/* - * TODO !getIgnoring().isIgnored(classInfo) && - */true) { - List> properties = new ArrayList>( - rootClassInfo.getProperties()); - for (MPropertyInfo propertyInfo0 : properties) { - - propertyInfo0 - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrapperPropertyInfo) { - - processWrapperElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo); - return null; - - } - }); - } - } - } - - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.elementwrapper.Customizations.IGNORED_ELEMENT_NAME); - } - - protected void processWrapperElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo) { - wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor( - new DefaultTypeInfoVisitor() { - @Override - public Void visitClassInfo( - final MClassInfo wrapperClassInfo) { - if (/* - * TODO !getIgnoring ( ).isIgnored ( classInfo ) && - */wrapperClassInfo.getProperties().size() == 1) { - final MPropertyInfo wrappedPropertyInfo = wrapperClassInfo - .getProperties().get(0); - - if (wrappedPropertyInfo.isCollection()) { - processWrappedPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - } - } - return null; - } - }); - } - - protected void processWrappedPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MPropertyInfo wrappedPropertyInfo) { - wrappedPropertyInfo - .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - - @Override - public Void visitElementPropertyInfo( - final MElementPropertyInfo wrappedPropertyInfo) { - processWrappedElementPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementsPropertyInfo( - MElementsPropertyInfo wrappedPropertyInfo) { - processWrappedElementsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefPropertyInfo( - final MElementRefPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - - @Override - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo wrappedPropertyInfo) { - processWrappedElementRefsPropertyInfo(mmodel, - rootClassInfo, wrapperPropertyInfo, - wrapperClassInfo, wrappedPropertyInfo); - return null; - } - }); - } - - protected void processWrappedElementPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - wrappedPropertyInfo.getTypeInfo(), - wrappedPropertyInfo.getElementName(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - - protected void processWrappedElementRefsPropertyInfo( - final MModelInfo mmodel, - final MClassInfo rootClassInfo, - final MElementPropertyInfo wrapperPropertyInfo, - final MClassInfo wrapperClassInfo, - final MElementRefsPropertyInfo wrappedPropertyInfo) { - System.out.println("Class info:" + rootClassInfo.getName()); - System.out.println("Wrapper property info:" - + wrapperPropertyInfo.getPrivateName()); - System.out.println("Wrapper class info :" + wrapperClassInfo.getName()); - System.out.println("Wrapped property info:" - + wrappedPropertyInfo.getPrivateName()); - - final MPropertyInfo propertyInfo = new CMElementRefsPropertyInfo( - new DummyPropertyInfoOrigin(), wrapperClassInfo, - wrapperPropertyInfo.getPrivateName(), - wrappedPropertyInfo.isCollection(), - - wrappedPropertyInfo.getElementTypeInfos(), - wrapperPropertyInfo.getElementName(), - wrappedPropertyInfo.isMixed(), - wrappedPropertyInfo.isDomAllowed(), - wrappedPropertyInfo.isTypedObjectAllowed()); - - rootClassInfo.addProperty(propertyInfo); - - // TODO - rootClassInfo.removeProperty(wrapperPropertyInfo); - mmodel.removeClassInfo(wrapperClassInfo); - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java deleted file mode 100644 index a9d6da65..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/elementwrapper/ElementWrapperPlugin1.java +++ /dev/null @@ -1,679 +0,0 @@ -//package org.jvnet.jaxb2_commons.plugin.elementwrapper; -// -//import java.io.File; -//import java.io.FileOutputStream; -//import java.io.FileReader; -//import java.io.IOException; -//import java.io.LineNumberReader; -//import java.io.PrintWriter; -//import java.util.ArrayList; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -// -//import javax.xml.bind.annotation.XmlElement; -//import javax.xml.bind.annotation.XmlElementWrapper; -// -//import org.xml.sax.ErrorHandler; -// -// -// -//import com.sun.codemodel.JAnnotationUse; -//import com.sun.codemodel.JClass; -//import com.sun.codemodel.JDefinedClass; -//import com.sun.codemodel.JExpr; -//import com.sun.codemodel.JFieldVar; -//import com.sun.codemodel.JMethod; -//import com.sun.codemodel.JMod; -//import com.sun.codemodel.JPackage; -//import com.sun.tools.xjc.BadCommandLineException; -//import com.sun.tools.xjc.Options; -//import com.sun.tools.xjc.Plugin; -//import com.sun.tools.xjc.model.CClassInfo; -//import com.sun.tools.xjc.model.CClassInfoParent; -//import com.sun.tools.xjc.model.CElementPropertyInfo; -//import com.sun.tools.xjc.model.CPropertyInfo; -//import com.sun.tools.xjc.model.CTypeInfo; -//import com.sun.tools.xjc.model.Model; -//import com.sun.tools.xjc.outline.ClassOutline; -//import com.sun.tools.xjc.outline.FieldOutline; -//import com.sun.tools.xjc.outline.Outline; -//import com.sun.tools.xjc.outline.PackageOutline; -//import com.sun.xml.bind.v2.model.core.ClassInfo; -// -//public class ElementWrapperPlugin1 extends Plugin -//{ -// -// protected Map candidates = null; -// protected File includeFile = null; -// protected Set include = null; -// protected File excludeFile = null; -// protected Set exclude = null; -// protected File summaryFile = null; -// protected PrintWriter summary = null; -// protected boolean debugMode = false; -// protected boolean verbose = false; -// @SuppressWarnings("unchecked") -// protected Class interfaceClass = java.util.List.class; -// @SuppressWarnings("unchecked") -// protected Class collectionClass = java.util.ArrayList.class; -// protected Instantiation instantiation = Instantiation.EARLY; -// protected boolean deleteCandidates = false; -// protected String factoryClassName = "ObjectFactory"; -// protected String debugClassName = "JAXBDebug"; -// -// public ElementWrapperPlugin1() -// { -// } -// -// @Override -// public String getOptionName() -// { -// return "Xxew"; -// } -// -// @Override -// public String getUsage() -// { -// return " -Xxew: Replace collection types with fields having the @XmlElementWrapper and @XmlElement annotations."; -// } -// -// @Override -// public void onActivated(Options opts) throws BadCommandLineException -// { -// debugMode = opts.debugMode; -// verbose = opts.verbose; -// -// // If we are in debug mode, report... -// writeDebug("JAXB Compilation started (onActivated):"); -// writeDebug("\tbuildId :\t" + Options.getBuildID()); -// writeDebug("\tdefaultPackage :\t" + opts.defaultPackage); -// writeDebug("\tdefaultPackage2:\t" + opts.defaultPackage2); -// writeDebug("\tquiet :\t" + opts.quiet); -// writeDebug("\tdebug :\t" + opts.debugMode); -// writeDebug("\ttargetDir :\t" + opts.targetDir); -// writeDebug("\tverbose :\t" + opts.verbose); -// writeDebug("\tGrammars :\t" + opts.getGrammars().length); -// for (int i = 0; i < opts.getGrammars().length; i++) -// writeDebug("\t [" + i + "]: " + opts.getGrammars()[i].getSystemId()); -// } -// -// @Override -// public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, -// IOException -// { -// -// int recognized = 0; -// String filename; -// -// String arg = args[i]; -// writeDebug("Argument[" + i + "] = " + arg); -// -// if (arg.startsWith("-delete")) -// { -// recognized++; -// deleteCandidates = true; -// } -// else if (arg.startsWith("-include")) -// { -// recognized++; -// include = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// includeFile = new File(filename); -// readCandidates(includeFile, include); -// } -// else if (arg.startsWith("-exclude")) -// { -// recognized++; -// exclude = new HashSet(); -// -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// excludeFile = new File(filename); -// readCandidates(excludeFile, exclude); -// } -// else if (arg.startsWith("-summary")) -// { -// recognized++; -// if (arg.length() > 8) -// { -// filename = arg.substring(8).trim(); -// } -// else -// { -// filename = args[i + 1]; -// recognized++; -// } -// -// summaryFile = new File(filename); -// summary = new PrintWriter(new FileOutputStream(summaryFile)); -// } -// else if (arg.startsWith("-collection")) -// { -// String ccn; -// -// recognized++; -// if (arg.length() > 11) -// { -// ccn = arg.substring(11).trim(); -// } -// else -// { -// ccn = args[i + 1]; -// recognized++; -// } -// try -// { -// collectionClass = Class.forName(ccn); -// } -// catch (ClassNotFoundException e) -// { -// throw new BadCommandLineException("-collection " + ccn + ": Class not found."); -// } -// } -// else if (arg.startsWith("-instantiate")) -// { -// String instantiate; -// recognized++; -// -// if (arg.length() > 12) -// { -// instantiate = arg.substring(12).trim().toUpperCase(); -// } -// else -// { -// instantiate = args[i + 1].trim().toUpperCase(); -// recognized++; -// } -// instantiation = Instantiation.valueOf(instantiate); -// } -// else -// { -// //throw new BadCommandLineException("Invalid argument " + arg); -// } -// -// -// -// return recognized; -// } -// -// -// @Override -// public void postProcessModel(Model model, ErrorHandler errorHandler) -// { -// super.postProcessModel(model, errorHandler); -// } -// -// @Override -// public boolean run(Outline model, Options opt, ErrorHandler errorHandler) -// { -// int candidateCount = 0; -// int modificationCount = 0; -// int deletionCount = 0; -// -// JDefinedClass implementationClass; -// Candidate candidate; -// String fieldName; -// String typeName; -// Collection methodsToRemove; -// -// writeDebug("JAXB Process Model (run)..."); -// -// // Write summary information on the option for this compilation. -// writeSummary(" "); -// writeSummary("Compilation:"); -// writeSummary("\tDate :\t-"); -// writeSummary("\tVersion :\t-"); -// writeSummary("\tJAXB version :\t" + Options.getBuildID()); -// writeSummary("\tInclude file :\t" + (includeFile == null ? "" : includeFile)); -// writeSummary("\tExclude file :\t" + (excludeFile == null ? "" : excludeFile)); -// writeSummary("\tSummary file :\t" + (summaryFile == null ? "" : summaryFile)); -// writeSummary("\tInstantiate :\t" + instantiation); -// writeSummary("\tCollection :\t" + collectionClass); -// writeSummary("\tInterface :\t" + interfaceClass); -// writeSummary("\tDelete :\t" + deleteCandidates); -// writeSummary(" "); -// -// // Find candidate classes for transformation. -// // Candidates are classes having exactly one field which is a collection. -// candidates = findCandidateClasses(model.getModel(), errorHandler); -// -// // Write information on candidate classes to summary file. -// writeSummary("Candidates:"); -// for (Candidate c : candidates.values()) -// { -// if (isIncluded(c)) -// { -// writeSummary("\t[+] " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// candidateCount++; -// } -// else -// writeSummary("\t[-]: " + getIncludeOrExcludeReason(c) + ":\t" + c.getClassName()); -// } -// writeSummary("\t" + candidateCount + " candidate(s) being considered."); -// writeSummary(" "); -// -// // Visit all classes generated by JAXB. -// writeSummary("Modifications:"); -// for (ClassOutline classOutline : model.getClasses()) -// { -// // Get the implementation class for the current class. -// implementationClass = classOutline.implClass; -// -// // Visit all fields in this class. -// for (FieldOutline field : classOutline.getDeclaredFields()) -// { -// -// // Extract the field name and type of the current field. -// fieldName = field.getPropertyInfo().getName(false); -// typeName = field.getRawType().fullName(); -// -// // Check to see if the current field references one of the candidate classes. -// candidate = candidates.get(typeName); -// -// if (candidate != null && isIncluded(candidate)) -// { -// // We have a candidate field to be replaced with a wrapped version. Report finding to -// // summary file. -// writeSummary("\t" + classOutline.target.getName() + "#" + fieldName + "\t" + typeName); -// modificationCount++; -// -// // Create the new interface and collection classes using the specified interface and -// // collection classes (configuration) with an element type corresponding to -// // the element type from the collection present in the candidate class (narrowing). -// JDefinedClass candidateClass = model.getClazz(candidate.getClassInfo()).implClass; -// List itemNarrowing = ((JClass) candidateClass.fields().get( -// candidate.getFieldName()).type()).getTypeParameters(); -// JClass newInterfaceClass = implementationClass.owner().ref(interfaceClass).narrow( -// itemNarrowing); -// JClass newCollectionClass = implementationClass.owner().ref(collectionClass).narrow( -// itemNarrowing); -// -// // Remove original field which refers to the inner class. -// JFieldVar implField = implementationClass.fields().get(fieldName); -// implementationClass.removeField(implField); -// -// // Add new wrapped version of the field using the original field name. -// // CODE: protected I fieldName; -// implField = implementationClass.field(JMod.PROTECTED, newInterfaceClass, fieldName); -// -// // If instantiation is specified to be "early", add code for creating new instance of the -// // collection class. -// if (instantiation == Instantiation.EARLY) -// { -// writeDebug("Applying EARLY instantiation..."); -// // CODE: ... fieldName = new C(); -// implField.init(JExpr._new(newCollectionClass)); -// } -// -// // Annotate the new field with the @XmlElementWrapper annotation using the original field -// // name as name. -// JAnnotationUse annotation = implField.annotate(XmlElementWrapper.class); -// annotation.param("name", ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())); -// writeDebug("XmlElementWrapper(name=" + (ElementWrapperPlugin1.elementName(field.getPropertyInfo()) == null ? fieldName : ElementWrapperPlugin1.elementName(field.getPropertyInfo())) + ")"); -// -// // Annotate the new field with the @XmlElement annotation using the field name from the -// // wrapped type as name. -// annotation = implField.annotate(XmlElement.class); -// annotation.param("name", candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()); -// writeDebug("XmlElement(name=" + (candidate.getWrappedSchemaTypeName() == null ? candidate.getFieldName() : candidate.getWrappedSchemaTypeName()) + ")"); -// -// // Find original getter and setter methods to remove. -// methodsToRemove = new ArrayList(); -// for (JMethod m : implementationClass.methods()) -// if (m.name().equals("set" + firstUpper(fieldName)) -// || m.name().equals("get" + firstUpper(fieldName))) methodsToRemove.add(m); -// -// // Remove original getter and setter methods. -// for (JMethod m : methodsToRemove) -// implementationClass.methods().remove(m); -// -// // Add a new getter method returning the (wrapped) field added. -// // CODE: public I getFieldname() { ... }; -// JMethod method = implementationClass.method(JMod.PUBLIC, newInterfaceClass, "get" -// + firstUpper(fieldName)); -// -// if (instantiation == Instantiation.LAZY) -// { -// writeDebug("Applying LAZY instantiation..."); -// // CODE: if (fieldName == null) fieldName = new C(); -// method.body()._if(JExpr.ref(fieldName).eq(JExpr._null()))._then().assign( -// JExpr.ref(fieldName), JExpr._new(newCollectionClass)); -// } -// -// // CODE: return "fieldName"; -// method.body()._return(JExpr.ref(fieldName)); -// } -// } -// } -// writeSummary("\t" + modificationCount + " modification(s) to original code."); -// writeSummary(" "); -// -// writeSummary("Deletions:"); -// if (deleteCandidates) -// { -// -// // REMOVED: -// // Get the default package from options. -// // This code was used earlier to only get the factory class from the default package. -// // pkg = model.getModel().codeModel._package(opt.defaultPackage); -// // JDefinedClass factoryClass = pkg._getClass(factoryClassName); -// -// JPackage pkg; -// -// // Get the factory class from the default package. -// JDefinedClass factoryClass; -// JDefinedClass candidateClass; -// -// // Visit all candidate classes. -// for (Candidate c : candidates.values()) -// { -// // Only consider candidates that are actually included... -// if (isIncluded(c)) -// { -// // Get the defined class for candidate class. -// candidateClass = model.getClazz(c.getClassInfo()).implClass; -// -// // ADDED: -// // This code was added to locate the ObjectFactory inside the package of the candidate class. -// pkg = candidateClass._package(); -// factoryClass = pkg._getClass(factoryClassName); -// -// // Remove methods referencing the candidate class from the ObjectFactory. -// methodsToRemove = new ArrayList(); -// for (JMethod m : factoryClass.methods()) -// if (m.type().compareTo(candidateClass) == 0) methodsToRemove.add(m); -// -// for (JMethod m : methodsToRemove) -// { -// writeSummary("\tRemoving method " + m.type().fullName() + " " + m.name() + " from " -// + factoryClass.fullName()); -// factoryClass.methods().remove(m); -// deletionCount++; -// } -// -// // Remove the candidate from the class or package it is defined in. -// if (candidateClass.parentContainer().isClass()) -// { -// // The candidate class is an inner class. Remove the class from its parent class. -// JDefinedClass parent = (JDefinedClass) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from class " -// + parent.fullName()); -// Iterator itor = parent.classes(); -// while (itor.hasNext()) -// if (itor.next().equals(candidateClass)) -// { -// itor.remove(); -// break; -// } -// deletionCount++; -// } -// else -// { -// // The candidate class in in a package. Remove the class from the package. -// JPackage parent = (JPackage) candidateClass.parentContainer(); -// writeSummary("\tRemoving class " + candidateClass.fullName() + " from package " -// + parent.name()); -// parent.remove(candidateClass); -// deletionCount++; -// } -// } -// } -// } -// writeSummary("\t" + deletionCount + " deletion(s) from original code."); -// writeSummary(" "); -// -// try -// { -// writeDebug("Closing summary..."); -// closeSummary(); -// } -// catch (IOException e) -// { -// // TODO BJH: How would this type of exception be reported? Should it just be ignored? -// } -// writeDebug("Done"); -// return true; -// } -// -// protected boolean isIncluded(Candidate candidate) -// { -// // -// // A candidate is included if, ... -// // 1. No includes and no excludes have been specified -// // 2. Includes have been specified and canditate is included, and no excludes have been -// // specified. -// // 3. No includes have been specified and excludes have been specified and candidate is not in -// // excludes. -// // 4. Both includes and excludes have been specified and candidate is in includes and not in -// // excludes. -// // -// if (!hasIncludes() && !hasExcludes()) -// return true; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return include.contains(candidate.getClassName()); // [+/-] (included) -// else if (!hasIncludes() && hasExcludes()) -// return !exclude.contains(candidate.getClassName()); // [+/-] (excluded) -// else -// return include.contains(candidate.getClassName()) -// && !exclude.contains(candidate.getClassName()); // [+/-] (override) -// } -// -// protected String getIncludeOrExcludeReason(Candidate candidate) -// { -// if (!hasIncludes() && !hasExcludes()) -// return "(default)"; // [+] (default) -// else if (hasIncludes() && !hasExcludes()) -// return "(included)"; -// else if (!hasIncludes() && hasExcludes()) -// return "(excluded)"; -// else -// return "(override)"; -// } -// -// protected boolean hasIncludes() -// { -// return include != null; -// } -// -// protected boolean hasExcludes() -// { -// return exclude != null; -// } -// -// /** -// * -// * @param file -// * @param candidates -// * @throws IOException -// */ -// protected void readCandidates(File file, Set candidates) throws IOException -// { -// LineNumberReader input; -// String line; -// -// input = new LineNumberReader(new FileReader(file)); -// while ((line = input.readLine()) != null) -// { -// line = line.trim(); -// -// // Lines starting with # are considered comments. -// if (!line.startsWith("#")) candidates.add(line); -// } -// input.close(); -// } -// -// /** -// * -// * @param s -// * @return -// */ -// protected String firstUpper(String s) -// { -// if (s == null) return null; -// if (s.length() == 0) return ""; -// return s.substring(0, 1).toUpperCase() + s.substring(1); -// } -// -// /** -// * -// * @param model -// * @param errorHandler -// * @return -// */ -// protected Map findCandidateClasses(Model model, ErrorHandler errorHandler) -// { -// Map candidates = new HashMap(); -// -// // Visit all beans created by JAXB processing. -// for (CClassInfo classInfo : model.beans().values()) -// { -// String className = classInfo.fullName(); -// -// // The candidate class must have exactly one property. -// if (classInfo.getProperties().size() == 1) -// { -// CPropertyInfo property = classInfo.getProperties().get(0); -// -// // The property must be a collection -// if (property.isCollection()) -// { -// if (property.ref().size() == 1) -// { -// // We have a candidate class. -// Candidate candidate = new Candidate(classInfo); -// candidates.put(className, candidate); -// writeDebug("Candidate found: " + candidate.getClassName() + ", " + candidate.getFieldName() + ", [" + candidate.getFieldTypeName() + "]"); -// } -// } -// } -// } -// return candidates; -// } -// -// protected void writeSummary(String s) -// { -// if (summary != null) -// { -// summary.println(s); -// if (verbose) System.out.println(s); -// } -// else if (verbose) System.out.println(s); -// } -// -// protected void closeSummary() throws IOException -// { -// if (summary != null) summary.close(); -// } -// -// protected void writeDebug(String s) -// { -// if (debugMode) System.out.println("DEBUG:" + s); -// } -// -// protected static String elementName(CPropertyInfo property) -// { -// try -// { -// if (property instanceof CElementPropertyInfo) -// { -// return ((CElementPropertyInfo) property).getTypes().get(0).getTagName().getLocalPart(); -// } -// else -// return null; -// } -// catch (Exception ex) -// { -// return null; -// } -// } -// -// enum Instantiation -// { -// EARLY, LAZY -// } -// -// /** -// * -// * @author bjh -// * -// */ -// class Candidate -// { -// protected CClassInfo classInfo; -// protected CPropertyInfo propertyInfo; -// protected CTypeInfo propertyTypeInfo; -// -// protected JDefinedClass implClass; -// protected JFieldVar field; -// protected String wrappedSchemaTypeName = null; -// -// public Candidate(CClassInfo classInfo) -// { -// this.classInfo = classInfo; -// this.propertyInfo = classInfo.getProperties().get(0); -// this.propertyTypeInfo = propertyInfo.ref().iterator().next(); -// this.wrappedSchemaTypeName = ElementWrapperPlugin1.elementName(propertyInfo); -// } -// -// public CClassInfo getClassInfo() -// { -// return classInfo; -// } -// -// public CPropertyInfo getPropertyInfo() -// { -// return propertyInfo; -// } -// -// public CTypeInfo getPropertyTypeInfo() -// { -// return propertyTypeInfo; -// } -// -// public String getClassName() -// { -// return classInfo.fullName(); -// } -// -// public String getFieldName() -// { -// return getPropertyInfo().getName(false); -// } -// -// public String getFieldTypeName() -// { -// return propertyTypeInfo.getType().fullName(); -// } -// -// public String getWrappedSchemaTypeName() -// { -// return wrappedSchemaTypeName; -// } -// } -// -// public static void main(String[] args) -// { -// -// } -//} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java deleted file mode 100644 index 0b550431..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/enumvalue"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java deleted file mode 100644 index 177a950c..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/enumvalue/EnumValuePlugin.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.enumvalue; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.EnumValue; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EnumValuePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XenumValue"; - } - - @Override - public String getUsage() { - return "Forces generated @XmlEnums implement the org.jvnet.jaxb2_commons.lang.EnumValue interface."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final EnumOutline enumOutline : outline.getEnums()) { - if (!getIgnoring().isIgnored(enumOutline)) { - processEnumOutline(enumOutline); - } - } - return true; - } - - protected void processEnumOutline(EnumOutline enumOutline) { - CEnumLeafInfo enumLeafInfo = enumOutline.target; - JClass enumType = enumLeafInfo.base.toType(enumOutline.parent(), - Aspect.EXPOSED).boxify(); - - final JDefinedClass theClass = enumOutline.clazz; - - ClassUtils._implements(theClass, theClass.owner().ref(EnumValue.class) - .narrow(enumType)); - - final JMethod enumValue$enumValue = theClass.method(JMod.PUBLIC, - enumType, "enumValue"); - enumValue$enumValue.body()._return(JExpr._this().invoke("value")); - } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java deleted file mode 100644 index dbc3ace9..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/equals"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java deleted file mode 100644 index 5d35be2b..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/equals/EqualsPlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Equals; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class EqualsPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xequals"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String equalsStrategyClass = JAXBEqualsStrategy.class.getName(); - - public void setEqualsStrategyClass(String equalsStrategyClass) { - this.equalsStrategyClass = equalsStrategyClass; - } - - public String getEqualsStrategyClass() { - return equalsStrategyClass; - } - - public JExpression createEqualsStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - EqualsStrategy.class, getEqualsStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.equals.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - - // @SuppressWarnings("unused") - // final JMethod equals0 = generateEquals$Equals0(classOutline, - // theClass); - @SuppressWarnings("unused") - final JMethod equals = generateEquals$equals(classOutline, theClass); - @SuppressWarnings("unused") - final JMethod objectEquals = generateObject$equals(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(Equals.class)); - // - // @SuppressWarnings("unused") - // final JMethod equals$equals = generateEquals$equals(enumOutline, - // theClass); - // } - - protected JMethod generateObject$equals(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod objectEquals = theClass.method(JMod.PUBLIC, - codeModel.BOOLEAN, "equals"); - { - final JVar object = objectEquals.param(Object.class, "object"); - final JBlock body = objectEquals.body(); - final JVar equalsStrategy = body.decl(JMod.FINAL, - codeModel.ref(EqualsStrategy.class), "strategy", - createEqualsStrategy(codeModel)); - body._return(JExpr.invoke("equals").arg(JExpr._null()) - .arg(JExpr._null()).arg(object).arg(equalsStrategy)); - } - return objectEquals; - } - - // protected JMethod generateEquals$Equals0(final ClassOutline classOutline, - // final JDefinedClass theClass) { - // final JMethod equalsEquals0 = theClass.method(JMod.PUBLIC, theClass - // .owner().BOOLEAN, "equals"); - // { - // final JVar object = equalsEquals0.param(Object.class, "object"); - // final JVar equalsStrategy = equalsEquals0.param( - // EqualsStrategy.class, "strategy"); - // final JBlock body = equalsEquals0.body(); - // - // body._return(JExpr.invoke("equals").arg(JExpr._null()).arg( - // JExpr._null()).arg(object).arg(equalsStrategy)); - // } - // return equalsEquals0; - // } - - protected JMethod generateEquals$equals(ClassOutline classOutline, - final JDefinedClass theClass) { - - final JCodeModel codeModel = theClass.owner(); - final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - "equals"); - { - final JBlock body = equals.body(); - final JVar leftLocator = equals.param(ObjectLocator.class, - "thisLocator"); - final JVar rightLocator = equals.param(ObjectLocator.class, - "thatLocator"); - final JVar object = equals.param(Object.class, "object"); - final JVar equalsStrategy = equals.param(EqualsStrategy.class, - "strategy"); - - final JConditional ifNotInstanceof = body._if(JOp.not(object - ._instanceof(theClass))); - ifNotInstanceof._then()._return(JExpr.FALSE); - - // - body._if(JExpr._this().eq(object))._then()._return(JExpr.TRUE); - - final Boolean superClassImplementsEquals = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - Equals.class); - - if (superClassImplementsEquals == null) { - // No superclass - } else if (superClassImplementsEquals.booleanValue()) { - body._if( - JOp.not(JExpr._super().invoke("equals") - .arg(leftLocator).arg(rightLocator).arg(object) - .arg(equalsStrategy)))._then() - ._return(JExpr.FALSE); - - } else { - body._if(JOp.not(JExpr._super().invoke("equals").arg(object))) - ._then()._return(JExpr.FALSE); - } - - final JExpression _this = JExpr._this(); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JVar _that = body.decl(JMod.FINAL, theClass, "that", - JExpr.cast(theClass, object)); - - for (final FieldOutline fieldOutline : declaredFields) { - - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _this); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, _that); - - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - - final JBlock block = body.block(); - - final String name = fieldOutline.getPropertyInfo().getName( - true); - - final JVar lhsValue = block.decl( - leftFieldAccessor.getType(), "lhs" + name); - leftFieldAccessor.toRawValue(block, lhsValue); - - final JVar rhsValue = block.decl( - rightFieldAccessor.getType(), "rhs" + name); - rightFieldAccessor.toRawValue(block, rhsValue); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(lhsValue); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rhsValue); - block._if( - JOp.not(JExpr.invoke(equalsStrategy, "equals") - .arg(leftFieldLocator) - .arg(rightFieldLocator).arg(lhsValue) - .arg(rhsValue)))._then() - ._return(JExpr.FALSE); - } - } - body._return(JExpr.TRUE); - } - return equals; - } - - // protected JMethod generateEquals$equals(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // final JCodeModel codeModel = theClass.owner(); - // final JMethod equals = theClass.method(JMod.PUBLIC, codeModel.BOOLEAN, - // "equals"); - // - // { - // final JBlock body = equals.body(); - // final JVar leftLocator = equals.param(ObjectLocator.class, - // "thisLocator"); - // final JVar rightLocator = equals.param(ObjectLocator.class, - // "thatLocator"); - // final JVar object = equals.param(Object.class, "object"); - // final JVar equalsStrategy = equals.param(EqualsStrategy.class, - // "strategy"); - // - // body._return(equalsStrategy - // .invoke("equals") - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(leftLocator) - // .arg("value").arg(JExpr._this().ref("value"))) - // .arg(codeModel.ref(LocatorUtils.class) - // .staticInvoke("property").arg(rightLocator) - // .arg("value").arg(object.ref("value"))) - // .arg(JExpr._this().ref("value")).arg(object.ref("value"))); - // - // } - // return equals; - // } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java deleted file mode 100644 index 3db7cf63..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/hashCode"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java deleted file mode 100644 index 571b6fbe..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/hashcode/HashCodePlugin.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.hashcode; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.HashCode; -import org.jvnet.jaxb2_commons.lang.HashCodeStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class HashCodePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XhashCode"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String hashCodeStrategyClass = JAXBHashCodeStrategy.class.getName(); - - public void setHashCodeStrategyClass(String hashCodeStrategy) { - this.hashCodeStrategyClass = hashCodeStrategy; - } - - public String getHashCodeStrategyClass() { - return hashCodeStrategyClass; - } - - public JExpression createHashCodeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - HashCodeStrategy.class, getHashCodeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.hashcode.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) { - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - } - // for (final EnumOutline enumOutline : outline.getEnums()) { - // if (!getIgnoring().isIgnored(enumOutline)) { - // processEnumOutline(enumOutline); - // } - // } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // classOutline, theClass); - @SuppressWarnings("unused") - final JMethod hashCode$hashCode = generateHashCode$hashCode( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod object$hashCode = generateObject$hashCode(classOutline, - theClass); - } - - // protected void processEnumOutline(EnumOutline enumOutline) { - // final JDefinedClass theClass = enumOutline.clazz; - // ClassUtils._implements(theClass, theClass.owner().ref(HashCode.class)); - // - // // @SuppressWarnings("unused") - // // final JMethod hashCode$hashCode0 = generateHashCode$hashCode0( - // // classOutline, theClass); - // @SuppressWarnings("unused") - // final JMethod hashCode$hashCode = generateHashCode$hashCode( - // enumOutline, theClass); - // // @SuppressWarnings("unused") - // // final JMethod object$hashCode = generateObject$hashCode(enumOutline, - // // theClass); - // } - - protected JMethod generateObject$hashCode(final ClassOutline classOutline, - final JDefinedClass theClass) { - return generateObject$hashCode(theClass); - } - - // protected JMethod generateObject$hashCode(final EnumOutline enumOutline, - // final JDefinedClass theClass) { - // return generateObject$hashCode(theClass); - // } - - private JMethod generateObject$hashCode(final JDefinedClass theClass) { - final JMethod object$hashCode = theClass.method(JMod.PUBLIC, - theClass.owner().INT, "hashCode"); - { - final JBlock body = object$hashCode.body(); - final JVar hashCodeStrategy = body.decl(JMod.FINAL, theClass - .owner().ref(HashCodeStrategy.class), "strategy", - createHashCodeStrategy(theClass.owner())); - body._return(JExpr._this().invoke("hashCode").arg(JExpr._null()) - .arg(hashCodeStrategy)); - } - return object$hashCode; - } - - protected JMethod generateHashCode$hashCode(ClassOutline classOutline, - final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - codeModel.INT, "hashCode"); - { - final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - "locator"); - final JVar hashCodeStrategy = hashCode$hashCode.param( - HashCodeStrategy.class, "strategy"); - final JBlock body = hashCode$hashCode.body(); - - final JExpression currentHashCodeExpression; - - final Boolean superClassImplementsHashCode = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - HashCode.class); - - if (superClassImplementsHashCode == null) { - currentHashCodeExpression = JExpr.lit(1); - } else if (superClassImplementsHashCode.booleanValue()) { - currentHashCodeExpression = JExpr._super().invoke("hashCode") - .arg(locator).arg(hashCodeStrategy); - } else { - currentHashCodeExpression = JExpr._super().invoke("hashCode"); - } - - final JVar currentHashCode = body.decl(codeModel.INT, - "currentHashCode", currentHashCodeExpression); - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - if (fieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - - final JVar theValue = block.decl( - fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - - fieldAccessor.toRawValue(block, theValue); - - block.assign( - currentHashCode, - hashCodeStrategy - .invoke("hashCode") - .arg(codeModel - .ref(LocatorUtils.class) - .staticInvoke("property") - .arg(locator) - .arg(fieldOutline.getPropertyInfo() - .getName(false)) - .arg(theValue)) - .arg(currentHashCode).arg(theValue)); - } - } - body._return(currentHashCode); - } - return hashCode$hashCode; - } - - // protected JMethod generateHashCode$hashCode(EnumOutline enumOutline, - // final JDefinedClass theClass) { - // - // JCodeModel codeModel = theClass.owner(); - // final JMethod hashCode$hashCode = theClass.method(JMod.PUBLIC, - // codeModel.INT, "hashCode"); - // final JVar locator = hashCode$hashCode.param(ObjectLocator.class, - // "locator"); - // final JVar hashCodeStrategy = hashCode$hashCode.param( - // HashCodeStrategy.class, "strategy"); - // final JBlock body = hashCode$hashCode.body(); - // - // body._return(hashCodeStrategy - // .invoke("hashCode") - // .arg(codeModel.ref(LocatorUtils.class).staticInvoke("property") - // .arg(locator).arg("value") - // .arg(JExpr._this().ref("value"))).arg(JExpr.lit(1)) - // .arg(JExpr._this().ref("value"))); - // - // return hashCode$hashCode; - // } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java deleted file mode 100644 index 391e18c1..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/Customizations.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.util.CustomizationUtils; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPluginCustomization; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/inheritance"; - - public static QName OBJECT_FACTORY_ELEMENT_NAME = new QName(NAMESPACE_URI, - "objectFactory"); - - public static QName EXTENDS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "extends"); - - public static QName IMPLEMENTS_ELEMENT_NAME = new QName(NAMESPACE_URI, - "implements"); - - private static final JAXBContext context; - static { - try { - context = JAXBContext.newInstance(ObjectFactory.class.getPackage() - .getName(), ObjectFactory.class.getClassLoader()); - } catch (JAXBException e) { - throw new ExceptionInInitializerError(e); - } - } - - public static JAXBContext getContext() { - return context; - } - - public static void _extends(CClassInfo classInfo, String className) { - final ExtendsClass extendsClass = new ExtendsClass(); - extendsClass.setClassName(className); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), Customizations.EXTENDS_ELEMENT_NAME, - extendsClass); - classInfo.getCustomizations().add(customization); - customization.markAsAcknowledged(); - - } - - public static void _implements(CClassInfo classInfo, - String... interfaceNames) { - for (String interfaceName : interfaceNames) { - final ImplementsInterface implementsInterface = new ImplementsInterface(); - implementsInterface.setInterfaceName(interfaceName); - final CPluginCustomization customization = CustomizationUtils - .marshal(getContext(), - Customizations.IMPLEMENTS_ELEMENT_NAME, - implementsInterface); - customization.markAsAcknowledged(); - classInfo.getCustomizations().add(customization); - } - - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java deleted file mode 100644 index 1dac274a..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ExtendsClass.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") -@XmlAccessorType(XmlAccessType.PROPERTY) -public class ExtendsClass { - - private String className; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java deleted file mode 100644 index 0b92216f..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ImplementsInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ImplementsInterface { - - private String interfaceName; - - @XmlValue - @XmlJavaTypeAdapter(value = CollapsedStringAdapter.class) - public String getInterfaceName() { - return interfaceName; - } - - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java deleted file mode 100644 index 0d8c96ec..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/InheritancePlugin.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIEnum; - -public class InheritancePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xinheritance"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays.asList(Customizations.EXTENDS_ELEMENT_NAME, - Customizations.IMPLEMENTS_ELEMENT_NAME, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - final Map knownClasses = new HashMap(); - final Map knownClassInfos = new IdentityHashMap(); - - for (final ClassOutline classOutline : outline.getClasses()) { - knownClasses.put(classOutline.implClass.fullName(), - classOutline.implClass); - knownClassInfos.put(classOutline.implClass, classOutline.target); - } - for (final ClassOutline classOutline : outline.getClasses()) { - processClassOutline(classOutline, knownClasses, knownClassInfos); - } - for (final EnumOutline enumOutline : outline.getEnums()) { - processEnumOutline(enumOutline, knownClasses); - } - for (final CElementInfo elementInfo : outline.getModel() - .getAllElements()) { - final ElementOutline elementOutline = outline - .getElement(elementInfo); - if (elementOutline != null) { - processElementOutline(elementOutline, knownClasses); - } - } - processPackageOutlines(outline, knownClasses); - return true; - } - - private void processClassOutline(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - - generateExtends(classOutline, knownClasses, knownClassInfos); - generateImplements(classOutline, knownClasses); - - } - - private void processEnumOutline(EnumOutline enumOutline, - Map knownClasses) { - - generateExtends(enumOutline, knownClasses); - generateImplements(enumOutline, knownClasses); - - } - - private void processElementOutline(ElementOutline elementOutline, - Map knownClasses) { - - generateExtends(elementOutline, knownClasses); - generateImplements(elementOutline, knownClasses); - - } - - private void processPackageOutlines(Outline outline, - Map knownClasses) { - List customizations = CustomizationUtils - .findCustomizations(outline, - Customizations.OBJECT_FACTORY_ELEMENT_NAME); - - for (CPluginCustomization customization : customizations) { - final ObjectFactoryCustomization objectFactoryCustomization = (ObjectFactoryCustomization) CustomizationUtils - .unmarshall(Customizations.getContext(), customization); - - final String packageName = objectFactoryCustomization - .getPackageName(); - - if (packageName != null) { - for (PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final JDefinedClass theClass = packageOutline - .objectFactory(); - if (packageName.equals(packageOutline._package().name())) { - ExtendsClass extendsClass = objectFactoryCustomization - .getExtendsClass(); - if (extendsClass != null) { - generateExtends(theClass, extendsClass, - knownClasses); - } - List implementsInterfaces = objectFactoryCustomization - .getImplementsInterface(); - if (implementsInterfaces != null) { - for (ImplementsInterface implementsInterface : implementsInterfaces) { - if (implementsInterface != null) { - generateImplements(theClass, - implementsInterface, knownClasses); - } - } - } - } - } - } - } - } - - private JClass generateExtends(ClassOutline classOutline, - Map knownClasses, - Map knownClassInfos) { - final JDefinedClass theClass = classOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(classOutline, - Customizations.EXTENDS_ELEMENT_NAME); - JClass targetClass = generateExtends(theClass, - extendsClassCustomization, knownClasses); - - final CClassInfo classInfo = classOutline.target; - if (targetClass != null && classInfo.getBaseClass() == null - && classInfo.getRefBaseClass() == null) { - final CClassInfo targetClassInfo = knownClassInfos.get(targetClass); - if (targetClassInfo == null && classInfo.getRefBaseClass() == null) { - final Model model = classInfo.model; - // BIEnum as BIClass is protected too much - final BIEnum decl = new BIEnum(); - decl.ref = targetClass.fullName(); - final CClassRef baseClass = new CClassRef(model, - classInfo.getSchemaComponent(), decl, - new CCustomizations()); - classInfo.setBaseClass(baseClass); - } else if (targetClassInfo != null - && classInfo.getBaseClass() == null) { - classInfo.setBaseClass(targetClassInfo); - } - } - return targetClass; - } - - private JClass generateExtends(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(enumOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final CPluginCustomization extendsClassCustomization = CustomizationUtils - .findCustomization(elementOutline, - Customizations.EXTENDS_ELEMENT_NAME); - return generateExtends(theClass, extendsClassCustomization, - knownClasses); - } - - private JClass generateExtends(final JDefinedClass theClass, - final CPluginCustomization extendsClassCustomization, - Map knownClasses) throws AssertionError { - if (extendsClassCustomization != null) { - - final ExtendsClass extendsClass = (ExtendsClass) CustomizationUtils - .unmarshall(Customizations.getContext(), - extendsClassCustomization); - - return generateExtends(theClass, extendsClass, knownClasses); - } else { - return null; - } - } - - private JClass generateExtends(final JDefinedClass theClass, - final ExtendsClass extendsClass, Map knownClasses) { - if (extendsClass.getClassName() != null) { - final String _class = extendsClass.getClassName(); - final JClass targetClass = parseClass(_class, theClass.owner(), - knownClasses); - theClass._extends(targetClass); - return targetClass; - } else { - return null; - } - } - - private List generateImplements(ClassOutline classOutline, - Map knownClasses) { - final JDefinedClass theClass = classOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(classOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(EnumOutline enumOutline, - Map knownClasses) { - final JDefinedClass theClass = enumOutline.clazz; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(enumOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(ElementOutline elementOutline, - Map knownClasses) { - final JDefinedClass theClass = elementOutline.implClass; - final List implementsInterfaceCustomizations = CustomizationUtils - .findCustomizations(elementOutline, - Customizations.IMPLEMENTS_ELEMENT_NAME); - return generateImplements(theClass, implementsInterfaceCustomizations, - knownClasses); - } - - private List generateImplements(final JDefinedClass theClass, - final List implementsInterfaceCustomizations, - Map knownClasses) throws AssertionError { - final List implementedInterfaces = new ArrayList( - implementsInterfaceCustomizations.size()); - for (final CPluginCustomization implementsInterfaceCustomization : implementsInterfaceCustomizations) { - if (implementsInterfaceCustomization != null) { - - final ImplementsInterface implementsInterface = (ImplementsInterface) org.jvnet.jaxb2_commons.util.CustomizationUtils - .unmarshall(Customizations.getContext(), - implementsInterfaceCustomization); - - final JClass implementedInterface = generateImplements( - theClass, implementsInterface, knownClasses); - if (implementedInterface != null) { - implementedInterfaces.add(implementedInterface); - } - } - } - return implementedInterfaces; - } - - private JClass generateImplements(final JDefinedClass theClass, - final ImplementsInterface implementsInterface, - Map knownClasses) { - - String _interface = implementsInterface.getInterfaceName(); - if (_interface != null) { - final JClass targetClass = parseClass(_interface, theClass.owner(), - knownClasses); - theClass._implements(targetClass); - return targetClass; - } else { - return null; - } - } - - private JClass parseClass(String _class, JCodeModel codeModel, - Map knownClasses) { - return new JavaTypeParser(knownClasses).parseClass(_class, codeModel); - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java deleted file mode 100644 index 165b8163..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import javax.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - - public ExtendsClass createExtendsClass() { - return new ExtendsClass(); - } - - public ImplementsInterface createImplementsInterface() { - return new ImplementsInterface(); - } - - public ObjectFactoryCustomization createObjectFactoryCustomization() { - return new ObjectFactoryCustomization(); - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java deleted file mode 100644 index 1a1d75d3..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/ObjectFactoryCustomization.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "objectFactory") -@XmlType(propOrder = { "extendsClass", "implementsInterface" }) -@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) -public class ObjectFactoryCustomization { - - private String packageName; - - @XmlAttribute - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - private ExtendsClass extendsClass; - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "extends") - public ExtendsClass getExtendsClass() { - return extendsClass; - } - - public void setExtendsClass(ExtendsClass extendsClass) { - this.extendsClass = extendsClass; - } - - private List implementsInterface = new ArrayList(); - - @XmlElement(namespace = "http://jaxb2-commons.dev.java.net/basic/inheritance", name = "implements") - public List getImplementsInterface() { - return implementsInterface; - } - - public void setImplementsInterface( - List implementsInterface) { - this.implementsInterface = implementsInterface; - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java deleted file mode 100644 index 233997ae..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/JavaTypeParser.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.JavaParser; -import japa.parser.ParseException; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class JavaTypeParser { - - static { -// JavaParser.setCacheParser(false); - } - - private final TypeToJTypeConvertingVisitor typeToJTypeConvertingVisitor; - - public JavaTypeParser() { - this(Collections. emptyMap()); - } - - public JavaTypeParser(Map knownClasses) { - Validate.notNull(knownClasses); - this.typeToJTypeConvertingVisitor = new TypeToJTypeConvertingVisitor( - knownClasses); - - } - - public JClass parseClass(String _class, JCodeModel codeModel) { - JType type = parseType(_class, codeModel); - if (type instanceof JClass) { - return (JClass) type; - } else { - throw new IllegalArgumentException("Type [" + _class - + "] is not a class."); - } - } - - private JType parseType(String type, JCodeModel codeModel) { - final String text = "public class Ignored extends " + type + " {}"; - try { - CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - final List _extended = classDeclaration - .getExtends(); - final ClassOrInterfaceType classOrInterfaceType = _extended.get(0); - - return classOrInterfaceType.accept( - this.typeToJTypeConvertingVisitor, codeModel); - } catch (ParseException pex) { - throw new IllegalArgumentException( - "Could not parse the type definition [" + type + "].", pex); - } catch (UnsupportedEncodingException uex) { - throw new UnsupportedOperationException(uex); - } - } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java deleted file mode 100644 index 021d97b3..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/inheritance/util/TypeToJTypeConvertingVisitor.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.util; - -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.PrimitiveType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; -import japa.parser.ast.type.VoidType; -import japa.parser.ast.type.WildcardType; -import japa.parser.ast.visitor.GenericVisitorAdapter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JType; - -public class TypeToJTypeConvertingVisitor extends - GenericVisitorAdapter { - - private final Map knownClasses; - - public TypeToJTypeConvertingVisitor(Map knownClasses) { - Validate.notNull(knownClasses); - this.knownClasses = knownClasses; - } - - @Override - public JType visit(VoidType type, JCodeModel codeModel) { - return codeModel.VOID; - } - - @Override - public JType visit(PrimitiveType type, JCodeModel codeModel) { - switch (type.getType()) { - case Boolean: - return codeModel.BOOLEAN; - case Char: - return codeModel.CHAR; - case Byte: - return codeModel.BYTE; - case Short: - return codeModel.SHORT; - case Int: - return codeModel.INT; - case Long: - return codeModel.LONG; - case Float: - return codeModel.FLOAT; - case Double: - return codeModel.DOUBLE; - default: - throw new AssertionError("Unknown primitive type [" - + type.getType() + "]"); - } - } - - @Override - public JType visit(ReferenceType type, JCodeModel codeModel) { - final JType referencedType = type.getType().accept(this, codeModel); - - JType referencedTypeArray = referencedType; - for (int index = 0; index < type.getArrayCount(); index++) { - referencedTypeArray = referencedTypeArray.array(); - } - return referencedTypeArray; - } - - @Override - public JType visit(WildcardType type, JCodeModel codeModel) { - - if (type.getExtends() != null) { - final ReferenceType _extends = type.getExtends(); - final JType boundType = _extends.accept(this, codeModel); - - if (!(boundType instanceof JClass)) { - throw new IllegalArgumentException("Bound type [" + _extends - + "]in the wildcard type must be class."); - } - - final JClass boundClass = (JClass) boundType; - return boundClass.wildcard(); - } else if (type.getSuper() != null) { - // TODO - throw new IllegalArgumentException( - "Wildcard types with super clause are not supported at the moment."); - } else { - throw new IllegalArgumentException( - "Wildcard type must have either extends or super clause."); - } - } - - @Override - public JType visit(ClassOrInterfaceType type, JCodeModel codeModel) { - final String name = getName(type); - final JClass knownClass = this.knownClasses.get(name); - final JClass jclass = knownClass != null ? knownClass : codeModel - .ref(name); - final List typeArgs = type.getTypeArgs(); - if (typeArgs == null || typeArgs.isEmpty()) { - return jclass; - } else { - final List jtypeArgs = new ArrayList( - typeArgs.size()); - for (Type typeArg : typeArgs) { - final JType jtype = typeArg.accept(this, codeModel); - if (!(jtype instanceof JClass)) { - throw new IllegalArgumentException("Type argument [" - + typeArg.toString() + "] is not a class."); - } else { - jtypeArgs.add((JClass) jtype); - } - } - return jclass.narrow(jtypeArgs); - } - } - - private String getName(ClassOrInterfaceType type) { - final String name = type.getName(); - final ClassOrInterfaceType scope = type.getScope(); - if (scope == null) { - return name; - } else { - return getName(scope) + "." + name; - } - } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java deleted file mode 100644 index 945ddd08..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/jaxbindex/JaxbIndexPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.jaxbindex; - -import org.jvnet.jaxb2_commons.util.CodeModelUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.fmt.JTextFile; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class JaxbIndexPlugin extends com.sun.tools.xjc.Plugin { - - public String getOptionName() { - return "Xjaxbindex"; - } - - public String getUsage() { - return "-Xjaxbindex: generate per-package jaxb.index file"; - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - - for (final PackageOutline packageOutline : outline - .getAllPackageContexts()) { - final StringBuilder sb = new StringBuilder(); - for (final ClassOutline classOutline : packageOutline.getClasses()) { - sb.append(CodeModelUtils.getLocalClassName(classOutline.ref)); - sb.append("\n"); - } - - final JTextFile indexFile = new JTextFile("jaxb.index"); - indexFile.setContents(sb.toString()); - packageOutline._package().addResourceFile(indexFile); - } - return true; - } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java deleted file mode 100644 index b3a2eb08..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/mergeable"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java deleted file mode 100644 index c83e1901..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/mergeable/MergeablePlugin.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy; -import org.jvnet.jaxb2_commons.lang.MergeFrom; -import org.jvnet.jaxb2_commons.lang.MergeStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class MergeablePlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xmergeable"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - private String mergeStrategyClass = JAXBMergeStrategy.class.getName(); - - public void setMergeStrategyClass( - final String mergeStrategyClass) { - this.mergeStrategyClass = mergeStrategyClass; - } - - public String getMergeStrategyClass() { - return mergeStrategyClass; - } - - public JExpression createMergeStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - MergeStrategy.class, getMergeStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.mergeable.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(MergeFrom.class)); - - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom0 = generateMergeFrom$mergeFrom0( - classOutline, theClass); - @SuppressWarnings("unused") - final JMethod mergeFrom$mergeFrom = generateMergeFrom$mergeFrom( - classOutline, theClass); - - if (!classOutline.target.isAbstract()) { - @SuppressWarnings("unused") - final JMethod createCopy = generateMergeFrom$createNewInstance( - classOutline, theClass); - - } - } - - protected JMethod generateMergeFrom$mergeFrom0( - final ClassOutline classOutline, final JDefinedClass theClass) { - - JCodeModel codeModel = theClass.owner(); - final JMethod mergeFrom$mergeFrom = theClass.method(JMod.PUBLIC, - codeModel.VOID, "mergeFrom"); - { - final JVar left = mergeFrom$mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom$mergeFrom.param(Object.class, "right"); - final JBlock body = mergeFrom$mergeFrom.body(); - - final JVar mergeStrategy = body.decl(JMod.FINAL, - codeModel.ref(MergeStrategy.class), "strategy", - createMergeStrategy(codeModel)); - - body.invoke("mergeFrom").arg(JExpr._null()).arg(JExpr._null()) - .arg(left).arg(right).arg(mergeStrategy); - } - return mergeFrom$mergeFrom; - } - - protected JMethod generateMergeFrom$mergeFrom(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod mergeFrom = theClass.method(JMod.PUBLIC, codeModel.VOID, - "mergeFrom"); - { - final JVar leftLocator = mergeFrom.param(ObjectLocator.class, - "leftLocator"); - final JVar rightLocator = mergeFrom.param(ObjectLocator.class, - "rightLocator"); - final JVar left = mergeFrom.param(Object.class, "left"); - final JVar right = mergeFrom.param(Object.class, "right"); - - final JVar mergeStrategy = mergeFrom.param(MergeStrategy.class, - "strategy"); - - final JBlock methodBody = mergeFrom.body(); - - Boolean superClassImplementsMergeFrom = StrategyClassUtils - .superClassImplements(classOutline, getIgnoring(), - MergeFrom.class); - - if (superClassImplementsMergeFrom == null) { - - } else if (superClassImplementsMergeFrom.booleanValue()) { - methodBody.invoke(JExpr._super(), "mergeFrom").arg(leftLocator) - .arg(rightLocator).arg(left).arg(right) - .arg(mergeStrategy); - } else { - - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - final JBlock body = methodBody._if(right._instanceof(theClass)) - ._then(); - - JVar target = body.decl(JMod.FINAL, theClass, "target", - JExpr._this()); - JVar leftObject = body.decl(JMod.FINAL, theClass, "leftObject", - JExpr.cast(theClass, left)); - JVar rightObject = body.decl(JMod.FINAL, theClass, - "rightObject", JExpr.cast(theClass, right)); - for (final FieldOutline fieldOutline : declaredFields) { - final FieldAccessorEx leftFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, leftObject); - final FieldAccessorEx rightFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, rightObject); - if (leftFieldAccessor.isConstant() - || rightFieldAccessor.isConstant()) { - continue; - } - final JBlock block = body.block(); - final JVar leftField = block.decl( - leftFieldAccessor.getType(), - "lhs" - + fieldOutline.getPropertyInfo().getName( - true)); - leftFieldAccessor.toRawValue(block, leftField); - final JVar rightField = block.decl( - rightFieldAccessor.getType(), - "rhs" - + fieldOutline.getPropertyInfo().getName( - true)); - - rightFieldAccessor.toRawValue(block, rightField); - - final JExpression leftFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(leftLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(leftField); - final JExpression rightFieldLocator = codeModel - .ref(LocatorUtils.class).staticInvoke("property") - .arg(rightLocator) - .arg(fieldOutline.getPropertyInfo().getName(false)) - .arg(rightField); - - final FieldAccessorEx targetFieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, target); - final JExpression mergedValue = JExpr.cast( - targetFieldAccessor.getType(), - mergeStrategy.invoke("merge").arg(leftFieldLocator) - .arg(rightFieldLocator).arg(leftField) - .arg(rightField)); - - final JVar merged = block.decl( - rightFieldAccessor.getType(), - "merged" - + fieldOutline.getPropertyInfo().getName( - true), mergedValue); - - targetFieldAccessor.fromRawValue(block, "unique" - + fieldOutline.getPropertyInfo().getName(true), - - merged); - } - } - } - return mergeFrom; - } - - protected JMethod generateMergeFrom$createNewInstance( - final ClassOutline classOutline, final JDefinedClass theClass) { - - final JMethod existingMethod = theClass.getMethod("createNewInstance", - new JType[0]); - if (existingMethod == null) { - - final JMethod newMethod = theClass.method(JMod.PUBLIC, theClass - .owner().ref(Object.class), "createNewInstance"); - { - final JBlock body = newMethod.body(); - body._return(JExpr._new(theClass)); - } - return newMethod; - } else { - return existingMethod; - } - } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java deleted file mode 100644 index b262c049..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/model/AbstractModelPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.model; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xjc.model.concrete.XJCCMInfoFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.reader.Ring; - -public abstract class AbstractModelPlugin extends AbstractParameterizablePlugin { - - protected MModelInfo getModel(Model model) { - try { - @SuppressWarnings("unchecked") - final MModelInfo modelInfo = (MModelInfo) Ring - .get(MModelInfo.class); - return modelInfo; - } catch (Throwable t) { - final MModelInfo mmodel = new XJCCMInfoFactory(model) - .createModel(); - Ring.add(MModelInfo.class, mmodel); - return mmodel; - } - } - - protected MModelOutline getModelOutline( - MModelInfo modelInfo, Outline outline, - Options options) { - try { - final MModelOutline modelOutline = (MModelOutline) Ring - .get(MModelOutline.class); - return modelOutline; - } catch (Throwable t) { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - return modelOutline; - } else { - throw new AssertionError("Model is expected to be generateable"); - } - } - } - - private MModelInfo modelInfo; - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - this.modelInfo = getModel(model); - postProcessModel(model, modelInfo, errorHandler); - } - - protected void postProcessModel(Model model, - MModelInfo modelInfo, ErrorHandler errorHandler) { - // Template method to be overridden by classes - } - - @Override - protected boolean run(Outline outline, Options options) throws Exception { - if (modelInfo.getOrigin() instanceof ModelOutlineGeneratorFactory) { - MModelOutlineGenerator generator = ((ModelOutlineGeneratorFactory) modelInfo - .getOrigin()).createGenerator(outline); - MModelOutline modelOutline = generator.generate(modelInfo); - Ring.add(MModelOutline.class, modelOutline); - } else { - throw new AssertionError("Model is expected to be generateable"); - } - return true; - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java deleted file mode 100644 index 6f1f26ec..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/collectionsetters"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java deleted file mode 100644 index fbc662d6..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/setters/SettersPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.setters; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class SettersPlugin extends AbstractParameterizablePlugin { - - private static final JType[] ABSENT = new JType[0]; - - @Override - public String getOptionName() { - return "Xsetters"; - } - - @Override - public String getUsage() { - return "Generates setters for collections."; - } - - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - - generateSetters(classOutline, theClass); - - } - - public static enum Mode { - - accessor { - - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - final FieldAccessor accessor = fieldOutline.create(JExpr - ._this()); - accessor.unsetValues(setter.body()); - accessor.fromRawValue(setter.body(), "draft", value); - } - }, - direct { - @Override - public void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value) { - - final JFieldVar field = theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - - if (field != null) { - setter.body().assign(JExpr._this().ref(field), value); - } else { - // Fallback to the accessor - Mode.accessor.generateSetter(fieldOutline, theClass, - setter, value); - } - } - }; - public abstract void generateSetter(FieldOutline fieldOutline, - JDefinedClass theClass, JMethod setter, JVar value); - } - - private Mode mode = Mode.accessor; - - public String getMode() { - return mode.name(); - - } - - public void setMode(String mode) { - Validate.notNull(mode); - try { - this.mode = Mode.valueOf(mode); - } catch (IllegalArgumentException iaex) { - throw new IllegalArgumentException( - "Unsupported mode [" - + mode - + "]." - + " Supported modes are [accessor] (uses JAXB-generated accessors, default)" - + " and [direct] (assigns the value to the field directly)."); - } - } - - private void generateSetters(ClassOutline classOutline, - JDefinedClass theClass) { - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - for (final FieldOutline fieldOutline : declaredFields) { - - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - - final String getterName = "get" + publicName; - - final JMethod getter = theClass.getMethod(getterName, ABSENT); - - if (getter != null) { - final JType type = getter.type(); - final JType rawType = fieldOutline.getRawType(); - final String setterName = "set" + publicName; - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - final JMethod setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - - if (setter == null) { - final JMethod generatedSetter = theClass.method( - JMod.PUBLIC, theClass.owner().VOID, setterName); - final JVar value = generatedSetter.param(type, "value"); - - mode.generateSetter(fieldOutline, theClass, - generatedSetter, value); - } - } - } - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.setters.Customizations.IGNORED_ELEMENT_NAME); - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java deleted file mode 100644 index 783cf37b..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/Customizations.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/simplify"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - - public static QName AS_ELEMENT_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-element-property"); - - public static QName AS_REFERENCE_PROPERTY_ELEMENT_NAME = new QName( - NAMESPACE_URI, "as-reference-property"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java deleted file mode 100644 index 97de9dd7..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.simplify; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo.CollectionMode; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeRef; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.ID; - -public class SimplifyPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xsimplify"; - } - - @Override - public String getUsage() { - return "This plugin allows simplifying \"complex\" properties" - + " (ex. aOrBOrC generated from repeatable choices)" - + " into several \"simple\" properties (ex. a, b, c).\n" - + " Please visit http://confluence.highsource.org/display/J2B/Simplify+Plugin" - + " for plugin documentation."; - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public void postProcessModel(final Model model, ErrorHandler errorHandler) { - - for (final CClassInfo classInfo : model.beans().values()) { - postProcessClassInfo(model, classInfo); - } - } - - private void postProcessClassInfo(final Model model, - final CClassInfo classInfo) { - final List properties = new ArrayList( - classInfo.getProperties()); - for (CPropertyInfo property : properties) { - property.accept(new CPropertyVisitor() { - - public Void onElement(CElementPropertyInfo elementProperty) { - postProcessElementPropertyInfo(model, classInfo, - elementProperty); - return null; - } - - public Void onAttribute(CAttributePropertyInfo attributeProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onValue(CValuePropertyInfo valueProperty) { - // TODO Auto-generated method stub - return null; - } - - public Void onReference(CReferencePropertyInfo p) { - postProcessReferencePropertyInfo(model, classInfo, p); - return null; - } - - }); - } - } - - private void postProcessElementPropertyInfo(final Model model, - final CClassInfo classInfo, CElementPropertyInfo property) { - if (property.isCollection() && property.getTypes().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyElementPropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } - } - } - - private void postProcessReferencePropertyInfo(final Model model, - final CClassInfo classInfo, CReferencePropertyInfo property) { - if (property.isCollection() && property.getElements().size() > 1) { - if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_ELEMENT_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsElementPropertyInfo(model, - classInfo, property); - } else if (CustomizationUtils - .containsCustomization( - property, - org.jvnet.jaxb2_commons.plugin.simplify.Customizations.AS_REFERENCE_PROPERTY_ELEMENT_NAME)) { - simplifyReferencePropertyInfoAsReferencePropertyInfo(model, - classInfo, property); - } - } - } - - private void simplifyElementPropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CElementPropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CTypeRef typeRef : property.getTypes()) { - final CElementPropertyInfo elementPropertyInfo = createElementPropertyInfo( - model, property, typeRef); - classInfo.getProperties().add(index++, elementPropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsReferencePropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CReferencePropertyInfo referencePropertyInfo = createReferencePropertyInfo( - model, property, element); - classInfo.getProperties().add(index++, referencePropertyInfo); - } - classInfo.getProperties().remove(property); - } - - private void simplifyReferencePropertyInfoAsElementPropertyInfo( - final Model model, final CClassInfo classInfo, - CReferencePropertyInfo property) { - int index = classInfo.getProperties().indexOf(property); - for (CElement element : property.getElements()) { - final CElementPropertyInfo elementPropertyInfo; - if (element instanceof CElementInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CElementInfo) element); - } else if (element instanceof CClassInfo) { - elementPropertyInfo = createElementPropertyInfo(model, element, - (CClassInfo) element); - - } else if (element instanceof CClassRef) { - // elementPropertyInfo = createElementPropertyInfo(model, - // element, - // (CClassRef) element); - elementPropertyInfo = null; - // TODO WARN - - } else { - // TODO WARN - elementPropertyInfo = null; - } - if (elementPropertyInfo != null) { - classInfo.getProperties().add(index++, elementPropertyInfo); - } - } - classInfo.getProperties().remove(property); - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CElementInfo elementInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(elementInfo.getContentType(), element - .getElementName(), elementInfo.getContentType() - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElement element, final CClassInfo classInfo) { - final CElementPropertyInfo elementPropertyInfo; - final String propertyName = createPropertyName(model, element); - elementPropertyInfo = new CElementPropertyInfo(propertyName, - CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), false); - elementPropertyInfo.getTypes().add( - new CTypeRef(classInfo, element.getElementName(), classInfo - .getTypeName(), false, null)); - return elementPropertyInfo; - } - - // private CElementPropertyInfo createElementPropertyInfo(final Model model, - // CElement element, final CClassRef cr) { - // final CElementPropertyInfo elementPropertyInfo; - // final String propertyName = createPropertyName(model, element); - // elementPropertyInfo = new CElementPropertyInfo(propertyName, - // CollectionMode.REPEATED_ELEMENT, ID.NONE, null, - // element.getSchemaComponent(), element.getCustomizations(), - // element.getLocator(), false); - // elementPropertyInfo.getTypes().add( - // new CTypeRef(cr, element.getElementName(), cr.getTypeName(), - // false, null)); - // return elementPropertyInfo; - // } - - private CReferencePropertyInfo createReferencePropertyInfo( - final Model model, CReferencePropertyInfo property, CElement element) { - final String propertyName = createPropertyName(model, element); - final CReferencePropertyInfo referencePropertyInfo = new CReferencePropertyInfo( - propertyName, true, false, property.isMixed(), - element.getSchemaComponent(), element.getCustomizations(), - element.getLocator(), property.isDummy(), property.isContent(), - property.isMixedExtendedCust()); - referencePropertyInfo.getElements().add(element); - return referencePropertyInfo; - } - - private CElementPropertyInfo createElementPropertyInfo(final Model model, - CElementPropertyInfo property, CTypeRef typeRef) { - final String propertyName = createPropertyName(model, typeRef); - boolean required = false; - final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( - propertyName, CollectionMode.REPEATED_ELEMENT, typeRef - .getTarget().idUse(), typeRef.getTarget() - .getExpectedMimeType(), property.getSchemaComponent(), - property.getCustomizations(), property.getLocator(), required); - elementPropertyInfo.getTypes().add(typeRef); - return elementPropertyInfo; - } - - private String createPropertyName(final Model model, CElement element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getElementName().getLocalPart()); - return propertyName; - } - - private String createPropertyName(final Model model, CTypeRef element) { - final String propertyName = model.getNameConverter().toPropertyName( - element.getTagName().getLocalPart()); - return propertyName; - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java deleted file mode 100644 index 2f65dfb5..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/Customizations.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/toString"; - - public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI, - "ignored"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java deleted file mode 100644 index dc8eac3c..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/tostring/ToStringPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; -import org.jvnet.jaxb2_commons.lang.ToString; -import org.jvnet.jaxb2_commons.lang.ToStringStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.plugin.Customizations; -import org.jvnet.jaxb2_commons.plugin.CustomizedIgnoring; -import org.jvnet.jaxb2_commons.plugin.Ignoring; -import org.jvnet.jaxb2_commons.plugin.util.FieldOutlineUtils; -import org.jvnet.jaxb2_commons.plugin.util.StrategyClassUtils; -import org.jvnet.jaxb2_commons.util.ClassUtils; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.xml.sax.ErrorHandler; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class ToStringPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "XtoString"; - } - - @Override - public String getUsage() { - return "TBD"; - } - - private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public FieldAccessorFactory getFieldAccessorFactory() { - return fieldAccessorFactory; - } - - public void setFieldAccessorFactory( - FieldAccessorFactory fieldAccessorFactory) { - this.fieldAccessorFactory = fieldAccessorFactory; - } - - - private String toStringStrategyClass = JAXBToStringStrategy.class.getName(); - - public void setToStringStrategyClass( - String toStringStrategy) { - this.toStringStrategyClass = toStringStrategy; - } - - public String getToStringStrategyClass() { - return toStringStrategyClass; - } - - public JExpression createToStringStrategy(JCodeModel codeModel) { - return StrategyClassUtils.createStrategyInstanceExpression(codeModel, - ToStringStrategy.class, getToStringStrategyClass()); - } - - private Ignoring ignoring = new CustomizedIgnoring( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - - public Ignoring getIgnoring() { - return ignoring; - } - - public void setIgnoring(Ignoring ignoring) { - this.ignoring = ignoring; - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList( - org.jvnet.jaxb2_commons.plugin.tostring.Customizations.IGNORED_ELEMENT_NAME, - Customizations.IGNORED_ELEMENT_NAME, - Customizations.GENERATED_ELEMENT_NAME); - } - - @Override - public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { - for (final ClassOutline classOutline : outline.getClasses()) - if (!getIgnoring().isIgnored(classOutline)) { - processClassOutline(classOutline); - } - return true; - } - - protected void processClassOutline(ClassOutline classOutline) { - final JDefinedClass theClass = classOutline.implClass; - ClassUtils._implements(theClass, theClass.owner().ref(ToString.class)); - - @SuppressWarnings("unused") - final JMethod object$toString = generateObject$toString(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$append = generateToString$append(classOutline, - theClass); - @SuppressWarnings("unused") - final JMethod toString$appendFields = generateToString$appendFields( - classOutline, theClass); - } - - protected JMethod generateObject$toString(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod object$toString = theClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "toString"); - { - final JBlock body = object$toString.body(); - - final JVar toStringStrategy = - - body.decl(JMod.FINAL, codeModel.ref(ToStringStrategy.class), - "strategy", createToStringStrategy(codeModel)); - - final JVar buffer = body.decl(JMod.FINAL, codeModel - .ref(StringBuilder.class), "buffer", JExpr._new(codeModel - .ref(StringBuilder.class))); - body.invoke("append").arg(JExpr._null()).arg(buffer).arg( - toStringStrategy); - body._return(buffer.invoke("toString")); - } - return object$toString; - } - - protected JMethod generateToString$append(final ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - final JMethod toString$append = theClass.method(JMod.PUBLIC, codeModel - .ref(StringBuilder.class), "append"); - { - - final JVar locator = toString$append.param(ObjectLocator.class, - "locator"); - final JVar buffer = toString$append.param(StringBuilder.class, - "buffer"); - final JVar toStringStrategy = toString$append.param( - ToStringStrategy.class, "strategy"); - - final JBlock body = toString$append.body(); - - body.invoke(toStringStrategy, "appendStart").arg(locator).arg( - JExpr._this()).arg(buffer); - body.invoke("appendFields").arg(locator).arg(buffer).arg( - toStringStrategy); - body.invoke(toStringStrategy, "appendEnd").arg(locator).arg( - JExpr._this()).arg(buffer); - body._return(buffer); - } - return toString$append; - } - - protected JMethod generateToString$appendFields(ClassOutline classOutline, - final JDefinedClass theClass) { - final JCodeModel codeModel = theClass.owner(); - - final JMethod toString$appendFields = theClass.method(JMod.PUBLIC, - codeModel.ref(StringBuilder.class), "appendFields"); - { - final JVar locator = toString$appendFields.param( - ObjectLocator.class, "locator"); - final JVar buffer = toString$appendFields.param( - StringBuilder.class, "buffer"); - final JVar toStringStrategy = toString$appendFields.param( - ToStringStrategy.class, "strategy"); - final JBlock body = toString$appendFields.body(); - - final Boolean superClassImplementsToString = StrategyClassUtils - .superClassImplements(classOutline, ignoring, - ToString.class); - - if (superClassImplementsToString == null) { - // No superclass - } else if (superClassImplementsToString.booleanValue()) { - body.invoke(JExpr._super(), "appendFields").arg(locator).arg( - buffer).arg(toStringStrategy); - } else { - // Superclass does not implement ToString - } - - final FieldOutline[] declaredFields = FieldOutlineUtils.filter( - classOutline.getDeclaredFields(), getIgnoring()); - - if (declaredFields.length > 0) { - - for (final FieldOutline fieldOutline : declaredFields) { - final JBlock block = body.block(); - final FieldAccessorEx fieldAccessor = getFieldAccessorFactory() - .createFieldAccessor(fieldOutline, JExpr._this()); - final JVar theValue = block.decl(fieldAccessor.getType(), - "the" - + fieldOutline.getPropertyInfo().getName( - true)); - fieldAccessor.toRawValue(block, theValue); - - block.invoke(toStringStrategy, "appendField").arg(locator) - .arg(JExpr._this()).arg( - JExpr.lit(fieldOutline.getPropertyInfo() - .getName(false))).arg(buffer).arg( - theValue); - } - } - body._return(buffer); - } - return toString$appendFields; - } - -} \ No newline at end of file diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java deleted file mode 100644 index 85383363..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/ArrayUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Array; -import java.util.LinkedList; -import java.util.List; - -public class ArrayUtils { - - private ArrayUtils() { - - } - - public static T[] filter(T[] array, Predicate predicate, - Class theClass) { - - if (array == null) { - return null; - } else { - final List list = new LinkedList(); - for (T item : array) { - if (predicate.evaluate(item)) { - list.add(item); - } - } - @SuppressWarnings("unchecked") - final T[] newArray = (T[]) Array.newInstance(theClass, list.size()); - return list.toArray(newArray); - } - - } - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java deleted file mode 100644 index 3b84494d..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/FieldOutlineUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldOutlineUtils { - - private FieldOutlineUtils() { - - } - - public static FieldOutline[] filter(final FieldOutline[] fieldOutlines, - final Ignoring ignoring) { - return ArrayUtils.filter(fieldOutlines, new Predicate() { - public boolean evaluate(FieldOutline fieldOutline) { - return !ignoring.isIgnored(fieldOutline); - - } - }, FieldOutline.class); - } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java deleted file mode 100644 index a59d0c4c..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/Predicate.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -public interface Predicate { - - public boolean evaluate(T object); - -} \ No newline at end of file diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java deleted file mode 100644 index 6f95d0b1..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/util/StrategyClassUtils.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.plugin.Ignoring; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.ClassOutline; - -public class StrategyClassUtils { - public static JExpression createStrategyInstanceExpression( - JCodeModel codeModel, final Class strategyInterface, - final String strategyClassName) { - - try { - final Class strategyClass = Class.forName(strategyClassName); - final JClass strategyJClass = codeModel.ref(strategyClass); - try { - final Method getInstanceMethod = strategyClass.getMethod( - "getInstance", new Class[0]); - if (getInstanceMethod != null - && strategyInterface.isAssignableFrom(getInstanceMethod - .getReturnType()) - && Modifier.isStatic(getInstanceMethod.getModifiers()) - && Modifier.isPublic(getInstanceMethod.getModifiers())) { - return strategyJClass.staticInvoke("getInstance"); - } - - } catch (Exception ignored) { - // Nothing to do - } - try { - final Field instanceField = strategyClass.getField("INSTANCE"); - if (instanceField != null - && strategyInterface.isAssignableFrom(instanceField - .getType()) - && Modifier.isStatic(instanceField.getModifiers()) - && Modifier.isPublic(instanceField.getModifiers())) { - return strategyJClass.staticRef("INSTANCE"); - } - } catch (Exception ignored) { - // Nothing to do - } - return JExpr._new(strategyJClass); - } catch (ClassNotFoundException cnfex) { - final JClass strategyJClass = codeModel.ref(strategyClassName); - return JExpr._new(strategyJClass); - } - } - - public static Boolean superClassImplements(ClassOutline classOutline, - Ignoring ignoring, Class theInterface) { - if (classOutline.target.getBaseClass() != null) { - if (!ignoring.isIgnored(classOutline.parent().getClazz( - classOutline.target.getBaseClass()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } else if (classOutline.target.getRefBaseClass() != null) { - try { - if (theInterface.isAssignableFrom(Class - .forName(classOutline.target.getRefBaseClass() - .fullName()))) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } catch (ClassNotFoundException ignored) { - // We'll assume it does implement - return Boolean.TRUE; - } - } else { - return null; - } - } -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java deleted file mode 100644 index 673f2e53..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/Customizations.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import javax.xml.namespace.QName; - -public class Customizations { - - public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic/wildcard"; - - public static QName LAX_ELEMENT_NAME = new QName(NAMESPACE_URI, "lax"); - public static QName STRICT_ELEMENT_NAME = new QName(NAMESPACE_URI, "strict"); - public static QName SKIP_ELEMENT_NAME = new QName(NAMESPACE_URI, "skip"); - -} diff --git a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java b/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java deleted file mode 100644 index b44a1cb3..00000000 --- a/basics/trunk/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/wildcard/WildcardPlugin.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.wildcard; - -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.jvnet.jaxb2_commons.util.CustomizationUtils; -import org.xml.sax.ErrorHandler; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.xml.bind.v2.model.core.WildcardMode; - -public class WildcardPlugin extends AbstractParameterizablePlugin { - - @Override - public String getOptionName() { - return "Xwildcard"; - } - - @Override - public String getUsage() { - return "Allows specifying the wildcard mode in wildcard properties."; - } - - @Override - public void postProcessModel(Model model, ErrorHandler errorHandler) { - final boolean laxModel = CustomizationUtils.containsCustomization( - model, Customizations.LAX_ELEMENT_NAME); - final boolean skipModel = CustomizationUtils.containsCustomization( - model, Customizations.SKIP_ELEMENT_NAME); - final boolean strictModel = CustomizationUtils.containsCustomization( - model, Customizations.STRICT_ELEMENT_NAME); - for (CClassInfo classInfo : model.beans().values()) { - final boolean laxClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictClassInfo = CustomizationUtils - .containsCustomization(classInfo, - Customizations.STRICT_ELEMENT_NAME); - for (CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (propertyInfo instanceof CReferencePropertyInfo) { - final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) propertyInfo; - final boolean laxPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.LAX_ELEMENT_NAME); - final boolean skipPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.SKIP_ELEMENT_NAME); - final boolean strictPropertyInfo = CustomizationUtils - .containsCustomization(referencePropertyInfo, - Customizations.STRICT_ELEMENT_NAME); - - if (laxModel) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipModel) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictModel) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictClassInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - - if (laxPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.LAX); - } else if (skipPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.SKIP); - } else if (strictPropertyInfo) { - referencePropertyInfo.setWildcard(WildcardMode.STRICT); - } - } - } - } - } - - @Override - public Collection getCustomizationElementNames() { - return Arrays - .asList(org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.LAX_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.SKIP_ELEMENT_NAME, - org.jvnet.jaxb2_commons.plugin.wildcard.Customizations.STRICT_ELEMENT_NAME); - } - -} diff --git a/basics/trunk/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/basics/trunk/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin deleted file mode 100644 index 99ef7147..00000000 --- a/basics/trunk/basic/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin +++ /dev/null @@ -1,13 +0,0 @@ -org.jvnet.jaxb2_commons.plugin.jaxbindex.JaxbIndexPlugin -org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin -org.jvnet.jaxb2_commons.plugin.equals.EqualsPlugin -org.jvnet.jaxb2_commons.plugin.hashcode.HashCodePlugin -org.jvnet.jaxb2_commons.plugin.copyable.CopyablePlugin -org.jvnet.jaxb2_commons.plugin.mergeable.MergeablePlugin -org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin -org.jvnet.jaxb2_commons.plugin.setters.SettersPlugin -org.jvnet.jaxb2_commons.plugin.wildcard.WildcardPlugin -org.jvnet.jaxb2_commons.plugin.autoinheritance.AutoInheritancePlugin -org.jvnet.jaxb2_commons.plugin.elementwrapper.ElementWrapperPlugin -org.jvnet.jaxb2_commons.plugin.simplify.SimplifyPlugin -org.jvnet.jaxb2_commons.plugin.enumvalue.EnumValuePlugin \ No newline at end of file diff --git a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java b/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java deleted file mode 100644 index 9e803563..00000000 --- a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/copyable/tests/RunCopyablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.copyable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunCopyablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xcopyable"); - return args; - } - -} diff --git a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java b/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java deleted file mode 100644 index cae87c57..00000000 --- a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/equals/tests/RunEqualsPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.equals.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunEqualsPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xequals"); - return args; - } - -} diff --git a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java b/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java deleted file mode 100644 index 30bdf587..00000000 --- a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaParserTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.plugin.inheritance.util.JavaTypeParser; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; - -public class JavaParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final JavaTypeParser javaTypeParser = new JavaTypeParser(); - final JCodeModel codeModel = new JCodeModel(); - JClass comparator = javaTypeParser.parseClass("java.util.Comparator", - codeModel); - assertNotNull(comparator); - JClass integerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(integerComparator); - JClass wildcardIntegerComparator = javaTypeParser.parseClass( - "java.util.Comparator", codeModel); - assertNotNull(wildcardIntegerComparator); - } -} diff --git a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java b/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java deleted file mode 100644 index a2562048..00000000 --- a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/inheritance/tests/JavaTypeParserTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.inheritance.tests; - -import japa.parser.JavaParser; -import japa.parser.ast.CompilationUnit; -import japa.parser.ast.body.ClassOrInterfaceDeclaration; -import japa.parser.ast.body.TypeDeclaration; -import japa.parser.ast.type.ClassOrInterfaceType; -import japa.parser.ast.type.ReferenceType; -import japa.parser.ast.type.Type; - -import java.io.ByteArrayInputStream; -import java.util.List; - -import junit.framework.TestCase; - -public class JavaTypeParserTest extends TestCase { - - public void testParse() throws Exception { - - final String text = "public class Dummy implements java.util.Comparator{}"; - - final CompilationUnit compilationUnit = JavaParser.parse( - new ByteArrayInputStream(text.getBytes("UTF-8")), "UTF-8"); - final List typeDeclarations = compilationUnit - .getTypes(); - assertEquals(1, typeDeclarations.size()); - final TypeDeclaration typeDeclaration = typeDeclarations.get(0); - assertTrue(typeDeclaration instanceof ClassOrInterfaceDeclaration); - final ClassOrInterfaceDeclaration classDeclaration = (ClassOrInterfaceDeclaration) typeDeclaration; - assertEquals("Dummy", classDeclaration.getName()); - final List implementedInterfaces = classDeclaration - .getImplements(); - assertEquals(1, implementedInterfaces.size()); - final ClassOrInterfaceType implementedInterface = implementedInterfaces - .get(0); - assertEquals("Comparator", implementedInterface.getName()); - final List typeArgs = implementedInterface.getTypeArgs(); - assertEquals(1, typeArgs.size()); - final Type typeArg = typeArgs.get(0); - assertTrue(typeArg instanceof ReferenceType); - final ReferenceType referenceTypeArg = (ReferenceType) typeArg; - final Type referencedType = referenceTypeArg.getType(); - assertTrue(referencedType instanceof ClassOrInterfaceType); - final ClassOrInterfaceType typeArgType = (ClassOrInterfaceType) referencedType; - assertEquals("Integer", typeArgType.getName()); - - } -} diff --git a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java b/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java deleted file mode 100644 index 61aacd9f..00000000 --- a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/mergeable/tests/RunMergeablePlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.mergeable.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunMergeablePlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-Xmergeable"); - return args; - } - -} diff --git a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java b/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java deleted file mode 100644 index 825ec260..00000000 --- a/basics/trunk/basic/src/test/java/org/jvnet/jaxb2_commons/plugin/tostring/tests/RunToStringPlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.tostring.tests; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class RunToStringPlugin extends RunXJC2Mojo { - - @Override - public File getSchemaDirectory() { - return new File(getBaseDir(), "src/test/resources"); - } - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-XtoString-toStringStrategy=" - + JAXBToStringStrategy.class.getName()); - return args; - } - -} diff --git a/basics/trunk/basic/src/test/resources/schema.xsd b/basics/trunk/basic/src/test/resources/schema.xsd deleted file mode 100644 index 3d80137f..00000000 --- a/basics/trunk/basic/src/test/resources/schema.xsd +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/build-1.6.bat b/basics/trunk/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/trunk/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/trunk/deploy.bat b/basics/trunk/deploy.bat deleted file mode 100644 index 46e8f569..00000000 --- a/basics/trunk/deploy.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -DperformRelease -DcontinuousIntegrationDeploy clean deploy >std 2>err \ No newline at end of file diff --git a/basics/trunk/dist/src/main/assembly/dist-with-dependencies.xml b/basics/trunk/dist/src/main/assembly/dist-with-dependencies.xml deleted file mode 100644 index 58168f1c..00000000 --- a/basics/trunk/dist/src/main/assembly/dist-with-dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - dist-with-dependencies - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - lib - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/trunk/dist/src/main/assembly/dist.xml b/basics/trunk/dist/src/main/assembly/dist.xml deleted file mode 100644 index d8da7919..00000000 --- a/basics/trunk/dist/src/main/assembly/dist.xml +++ /dev/null @@ -1,25 +0,0 @@ - - dist - - zip - - - - - README* - LICENSE* - NOTICE* - - - - - - dist - - false - - org.jvnet.jaxb2_commons:* - - - - diff --git a/basics/trunk/install-1.6.bat b/basics/trunk/install-1.6.bat deleted file mode 100644 index 57a75b67..00000000 --- a/basics/trunk/install-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn -X -DperformRelease -Psamples,tests,dist clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/trunk/install.bat b/basics/trunk/install.bat deleted file mode 100644 index 490e34e0..00000000 --- a/basics/trunk/install.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn -X -DperformRelease -DcontinuousIntegrationInstall clean install >std 2>err \ No newline at end of file diff --git a/basics/trunk/jaxb/pom.xml b/basics/trunk/jaxb/pom.xml deleted file mode 100644 index 2ad49ae7..00000000 --- a/basics/trunk/jaxb/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - pom - JAXB2 Basics - Modular [jaxb] - Modular Maven build of JAXB RI - http://static.highsource.org/jaxb2-basics/jaxb - - org.sonatype.oss - oss-parent - 7 - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - xjc - - - install - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - \ No newline at end of file diff --git a/basics/trunk/jaxb/release.bat b/basics/trunk/jaxb/release.bat deleted file mode 100644 index e6784200..00000000 --- a/basics/trunk/jaxb/release.bat +++ /dev/null @@ -1 +0,0 @@ -call mvn clean deploy -DperformRelease=true -Psonatype-oss-release \ No newline at end of file diff --git a/basics/trunk/jaxb/xjc/pom.xml b/basics/trunk/jaxb/xjc/pom.xml deleted file mode 100644 index a2a60692..00000000 --- a/basics/trunk/jaxb/xjc/pom.xml +++ /dev/null @@ -1,218 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - jar - JAXB2 Basics - Modular [jaxb-xjc] - Modular build of schema compiler (XJC) from JAXB RI - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb - 2.2.5-2 - ../pom.xml - - - - CDDL v1.0 / GPL v2 dual license - https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html - repo - - - - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - scm:svn:https://jaxb2-commons-svn.dev.java.net/svn/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - https://jaxb2-commons-svn.dev.java.net/source/browse/jaxb2-commons-svn/trunk/basics/jaxb/xjc/ - - - - kohsuke - Kohsuke Kawaguchi - kohsuke.kawaguchi@sun.com - - - lexi - Aleksei Valikov - valikov@gmx.net - - - - - com.sun.codemodel - codemodel - 2.4 - - - com.sun.xml.dtd-parser - dtd-parser - 1.1 - - - com.sun.istack - istack-commons-tools - 2.2.MR1 - - - relaxngDatatype - relaxngDatatype - 20020414 - - - com.sun.org.apache.xml.internal - resolver - 20050927 - - - org.kohsuke.rngom - rngom - 20100718 - - - com.sun.xsom - xsom - 20100725 - - - com.sun.xml.bind - jaxb-impl - ${project.version} - - - org.apache.ant - ant - 1.7.0 - provided - - - - install - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-sources - - unpack - - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - sources - ${project.build.directory}/generated-sources/xjc - - com/sun/codemodel/**, - com/sun/dtdparser/**, - com/sun/istack/**, - com/sun/org/**, - com/sun/xml/**, - org/**, - javax/** - - - - com.sun.xml.bind - jaxb-xjc - 2.1.13 - jar - ${project.build.directory}/generated-resources/xjc - - - com/sun/tools/xjc/runtime/**/*.java_ - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/xjc - - - - - add-resource - generate-sources - - add-resource - - - - - - ${project.build.directory}/generated-sources/xjc - - **/*.java - - - - ${project.build.directory}/generated-resources/xjc - - **/*.java - **/*.java_ - - - - - - - - - - - - java-home-parent-lib-tools-jar - - false - - ${java.home}/../lib/tools.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - - - - - java-home-parent-classes-classes-jar - - false - - ${java.home}/../Classes/classes.jar - - - - - sun.jdk - tools - 1.5.0 - system - ${java.home}/../Classes/classes.jar - - - - - \ No newline at end of file diff --git a/basics/trunk/qrelease.bat b/basics/trunk/qrelease.bat deleted file mode 100644 index c71e5e88..00000000 --- a/basics/trunk/qrelease.bat +++ /dev/null @@ -1,76 +0,0 @@ -setlocal -echo Setting JAVA_HOME to %JAVA6_HOME%. -set JAVA_HOME=%JAVA6_HOME% - -echo Performing a short clean build. -rem pause -call mvn clean install -DperformRelease -echo Short clean build completed. -rem pause - -echo Performing a full clean build. -rem pause -call mvn clean install -DperformRelease -Psamples,tests,dist -echo Full clean build completed. -rem pause - -echo Setting new version to %1. -rem pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 -echo Version was set to %1. -rem pause -call mvn versions:commit -Psamples,tests,dist -echo Version %1 committed. -rem pause - -echo Performing a short clean build. -rem pause -call mvn clean install -DperformRelease -echo Short clean build completed. -rem pause - -echo Performing a full clean build. -rem pause -call mvn clean install -Psamples,tests,dist -DperformRelease -echo Full clean build completed. -rem pause - -echo Checking in version %1. -rem pause -call mvn scm:checkin -Dmessage="Version %1" -echo Version %1 was checked in. -rem pause - -echo Tagging version %1. -rem pause -call mvn scm:tag -Dtag=%1 -echo Version %1 was tagged. -rem pause - -echo Performing full clean deploy. -rem pause -call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy -echo Full clean deploy done. -rem pause - -echo Setting new version to %2. -rem pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 -echo Version was set to %2. -rem pause -call mvn versions:commit -Psamples,tests,dist -echo Version %2 was committed. -rem pause - -echo Performing a short clean build. -rem pause -call mvn clean install -DperformRelease -rem pause - -echo Checking in version %2. -rem pause -call mvn scm:checkin -Dmessage="Version %2" -echo Version %2 was checked in. -rem pause - -endlocal \ No newline at end of file diff --git a/basics/trunk/release.bat b/basics/trunk/release.bat deleted file mode 100644 index ca58cfd7..00000000 --- a/basics/trunk/release.bat +++ /dev/null @@ -1,76 +0,0 @@ -setlocal -echo Setting JAVA_HOME to %JAVA6_HOME%. -set JAVA_HOME=%JAVA6_HOME% - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -DperformRelease -Psamples,tests,dist -echo Full clean build completed. -pause - -echo Setting new version to %1. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 -echo Version was set to %1. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %1 committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -echo Short clean build completed. -pause - -echo Performing a full clean build. -pause -call mvn clean install -Psamples,tests,dist -DperformRelease -echo Full clean build completed. -pause - -echo Checking in version %1. -pause -call mvn scm:checkin -Dmessage="Version %1" -echo Version %1 was checked in. -pause - -echo Tagging version %1. -pause -call mvn scm:tag -Dtag=%1 -echo Version %1 was tagged. -pause - -echo Performing full clean deploy. -pause -call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy -echo Full clean deploy done. -pause - -echo Setting new version to %2. -pause -call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 -echo Version was set to %2. -pause -call mvn versions:commit -Psamples,tests,dist -echo Version %2 was committed. -pause - -echo Performing a short clean build. -pause -call mvn clean install -DperformRelease -pause - -echo Checking in version %2. -pause -call mvn scm:checkin -Dmessage="Version %2" -echo Version %2 was checked in. -pause - -endlocal \ No newline at end of file diff --git a/basics/trunk/runtime/.classpath b/basics/trunk/runtime/.classpath deleted file mode 100644 index 5d675fc8..00000000 --- a/basics/trunk/runtime/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/trunk/runtime/.project b/basics/trunk/runtime/.project deleted file mode 100644 index 5441da06..00000000 --- a/basics/trunk/runtime/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - jaxb2-basics-runtime - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java deleted file mode 100644 index 62538593..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.i18n; - -import java.util.ResourceBundle; - -/** - * Reportable object. - * - * @author Aleksei Valikov - */ -public interface Reportable -{ - /** - * Returns message code. This code will be used to locate message resource. - * - * @return String code that uniquely identifies this problem. May be used to reference messages. - */ - public String getMessageCode(); - - /** - * Returns parameters used to format the message. - * - * @return Array of parameters used to format problem message. - */ - public abstract Object[] getMessageParameters(); - - /** - * Formats the message using given resource bundle. - * - * @param bundle bundle to use resources from. - * @return Formatted message. - */ - public String getMessage(final ResourceBundle bundle); - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java deleted file mode 100644 index b93f676a..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public class ClassUtils { - - private ClassUtils() { - } - - public static final char PACKAGE_SEPARATOR_CHAR = '.'; - - public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; - - /** - *

- * Gets the class name minus the package name from a Class. - *

- * - * @param cls - * the class to get the short name for. - * @return the class name without the package name or an empty string - */ - @SuppressWarnings("unchecked") - public static String getShortClassName(Class cls) { - if (cls == null) { - return ""; - } - return getShortClassName(cls.getName()); - } - - /** - *

- * Gets the class name minus the package name from a String. - *

- * - *

- * The string passed in is assumed to be a class name - it is not checked. - *

- * - * @param className - * the className to get the short name for - * @return the class name of the class without the package name or an empty - * string - */ - public static String getShortClassName(String className) { - if (className == null) { - return ""; - } - if (className.length() == 0) { - return ""; - } - char[] chars = className.toCharArray(); - int lastDot = 0; - for (int i = 0; i < chars.length; i++) { - if (chars[i] == PACKAGE_SEPARATOR_CHAR) { - lastDot = i + 1; - } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner - // classes - chars[i] = PACKAGE_SEPARATOR_CHAR; - } - } - return new String(chars, lastDot, chars.length - lastDot); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java deleted file mode 100644 index 8b201bee..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -public class ContextUtils { - - public static String getContextPath(Class... classes) { - if (classes == null) { - throw new IllegalArgumentException("The validated object is null"); - } - for (int i = 0; i < classes.length; i++) { - if (classes[i] == null) { - throw new IllegalArgumentException("The validated array contains null element at index: " + i); - } - } - - final StringBuilder contextPath = new StringBuilder(); - - for (int index = 0; index < classes.length; index++) { - if (index > 0) { - contextPath.append(':'); - } - contextPath.append(classes[index].getPackage().getName()); - } - return contextPath.toString(); - } - - public static String toString(JAXBContext context, Object object) - throws JAXBException { - final Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - final StringWriter sw = new StringWriter(); - marshaller.marshal(object, sw); - return sw.toString(); - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java deleted file mode 100644 index 41a85a0f..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyStrategy { - - public boolean copy(ObjectLocator locator, boolean value); - - public byte copy(ObjectLocator locator, byte value); - - public char copy(ObjectLocator locator, char value); - - public double copy(ObjectLocator locator, double value); - - public float copy(ObjectLocator locator, float value); - - public int copy(ObjectLocator locator, int value); - - public long copy(ObjectLocator locator, long value); - - public short copy(ObjectLocator locator, short value); - - public Object copy(ObjectLocator locator, Object value); - - public boolean[] copy(ObjectLocator locator, boolean[] value); - - public byte[] copy(ObjectLocator locator, byte[] value); - - public char[] copy(ObjectLocator locator, char[] value); - - public double[] copy(ObjectLocator locator, double[] value); - - public float[] copy(ObjectLocator locator, float[] value); - - public int[] copy(ObjectLocator locator, int[] value); - - public long[] copy(ObjectLocator locator, long[] value); - - public short[] copy(ObjectLocator locator, short[] value); - - public Object[] copy(ObjectLocator locator, Object[] value); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java deleted file mode 100644 index 74cef3fa..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface CopyTo { - - public Object createNewInstance(); - - public Object copyTo(Object target); - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java deleted file mode 100644 index 622ea08a..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultCopyStrategy implements CopyStrategy { - - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object == null) { - return null; - } else if (object instanceof String) { - return object; - } else if (object instanceof Number) { - return object; - } else if (object instanceof CopyTo) { - return ((CopyTo) object).copyTo(locator, - ((CopyTo) object).createNewInstance(), this); - } else if (object instanceof Cloneable) { - return copyInternal(locator, (Cloneable) object); - } else { - return object; - } - } - - public Object copy(ObjectLocator locator, Object value) { - if (value == null) { - return null; - } - Class lhsClass = value.getClass(); - if (!lhsClass.isArray()) { - return copyInternal(locator, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - return copy(locator, (long[]) value); - } else if (value instanceof int[]) { - return copy(locator, (int[]) value); - } else if (value instanceof short[]) { - return copy(locator, (short[]) value); - } else if (value instanceof char[]) { - return copy(locator, (char[]) value); - } else if (value instanceof byte[]) { - return copy(locator, (byte[]) value); - } else if (value instanceof double[]) { - return copy(locator, (double[]) value); - } else if (value instanceof float[]) { - return copy(locator, (float[]) value); - } else if (value instanceof boolean[]) { - return copy(locator, (boolean[]) value); - } else { - // Not an array of primitives - return copy(locator, (Object[]) value); - } - } - - public long copy(ObjectLocator locator, long value) { - return value; - } - - public int copy(ObjectLocator locator, int value) { - return value; - } - - public short copy(ObjectLocator locator, short value) { - return value; - } - - public char copy(ObjectLocator locator, char value) { - return value; - } - - public byte copy(ObjectLocator locator, byte value) { - return value; - } - - public double copy(ObjectLocator locator, double value) { - return value; - } - - public float copy(ObjectLocator locator, float value) { - return value; - } - - public boolean copy(ObjectLocator locator, boolean value) { - return value; - } - - public Object[] copy(ObjectLocator locator, Object[] array) { - if (array == null) { - return null; - } - final Object[] copy = new Object[array.length]; - for (int index = 0; index < array.length; index++) { - final Object element = array[index]; - final Object elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public long[] copy(ObjectLocator locator, long[] array) { - if (array == null) { - return null; - } - final long[] copy = new long[array.length]; - for (int index = 0; index < array.length; index++) { - final long element = array[index]; - final long elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public int[] copy(ObjectLocator locator, int[] array) { - if (array == null) { - return null; - } - final int[] copy = new int[array.length]; - for (int index = 0; index < array.length; index++) { - final int element = array[index]; - final int elementCopy = copy(item(locator, index, element), element); - copy[index] = elementCopy; - } - return copy; - } - - public short[] copy(ObjectLocator locator, short[] array) { - if (array == null) { - return null; - } - final short[] copy = new short[array.length]; - for (int index = 0; index < array.length; index++) { - final short element = array[index]; - final short elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public char[] copy(ObjectLocator locator, char[] array) { - if (array == null) { - return null; - } - final char[] copy = new char[array.length]; - for (int index = 0; index < array.length; index++) { - final char element = array[index]; - final char elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public byte[] copy(ObjectLocator locator, byte[] array) { - if (array == null) { - return null; - } - final byte[] copy = new byte[array.length]; - for (int index = 0; index < array.length; index++) { - final byte element = array[index]; - final byte elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public double[] copy(ObjectLocator locator, double[] array) { - if (array == null) { - return null; - } - final double[] copy = new double[array.length]; - for (int index = 0; index < array.length; index++) { - final double element = array[index]; - final double elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public float[] copy(ObjectLocator locator, float[] array) { - if (array == null) { - return null; - } - final float[] copy = new float[array.length]; - for (int index = 0; index < array.length; index++) { - final float element = array[index]; - final float elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - public boolean[] copy(ObjectLocator locator, boolean[] array) { - if (array == null) { - return null; - } - final boolean[] copy = new boolean[array.length]; - for (int index = 0; index < array.length; index++) { - final boolean element = array[index]; - final boolean elementCopy = copy(item(locator, index, element), - element); - copy[index] = elementCopy; - } - return copy; - } - - protected Object copyInternal(ObjectLocator locator, Cloneable object) { - Method method = null; - - try { - method = object.getClass().getMethod("clone", (Class[]) null); - } catch (NoSuchMethodException nsmex) { - method = null; - } - - if (method == null || !Modifier.isPublic(method.getModifiers())) { - - throw new UnsupportedOperationException( - "Could not clone object [" + object + "].", - new CloneNotSupportedException( - "Object class [" - + object.getClass() - + "] implements java.lang.Cloneable interface, " - + "but does not provide a public no-arg clone() method. " - + "By convention, classes that implement java.lang.Cloneable " - + "should override java.lang.Object.clone() method (which is protected) " - + "with a public method.")); - } - - final boolean wasAccessible = method.isAccessible(); - try { - if (!wasAccessible) { - try { - method.setAccessible(true); - } catch (SecurityException ignore) { - } - } - - return method.invoke(object, (Object[]) null); - } catch (Exception ex) { - throw new UnsupportedOperationException( - "Could not clone the object [" - + object - + "] as invocation of the clone() method has thrown an exception.", - ex); - } finally { - if (!wasAccessible) { - try { - method.setAccessible(false); - } catch (SecurityException ignore) { - } - } - } - } - - public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java deleted file mode 100644 index d66a74b7..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java +++ /dev/null @@ -1,371 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultEqualsStrategy implements EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - Class lhsClass = lhs.getClass(); - if (!lhsClass.isArray()) { - return equalsInternal(leftLocator, rightLocator, lhs, rhs); - } else if (lhs.getClass() != rhs.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (lhs instanceof long[]) { - return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); - } else if (lhs instanceof int[]) { - return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); - } else if (lhs instanceof short[]) { - return equals(leftLocator, rightLocator, (short[]) lhs, - (short[]) rhs); - } else if (lhs instanceof char[]) { - return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); - } else if (lhs instanceof byte[]) { - return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); - } else if (lhs instanceof double[]) { - return equals(leftLocator, rightLocator, (double[]) lhs, - (double[]) rhs); - } else if (lhs instanceof float[]) { - return equals(leftLocator, rightLocator, (float[]) lhs, - (float[]) rhs); - } else if (lhs instanceof boolean[]) { - return equals(leftLocator, rightLocator, (boolean[]) lhs, - (boolean[]) rhs); - } else if (lhs instanceof Equals[]) { - return equalsInternal(leftLocator, rightLocator, (Equals[]) lhs, - (Equals[]) rhs); - } else if (lhs instanceof Enum[]) { - return equalsInternal(leftLocator, rightLocator, (Enum[]) lhs, - (Enum[]) rhs); - } else { - // Not an array of primitives - return equals(leftLocator, rightLocator, (Object[]) lhs, - (Object[]) rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else if (lhs instanceof Enum) { - return equalsInternal(leftLocator, rightLocator, (Enum) lhs, (Enum) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum lhs, Enum rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - if (lhs instanceof Equals) { - return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); - } else { - return lhs.equals(rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals lhs, Equals rhs) { - if (lhs == rhs) { - return true; - } - if (lhs == null || rhs == null) { - return false; - } - return lhs.equals(leftLocator, rightLocator, rhs, this); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right) { - - return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), - Double.doubleToLongBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right) { - return equals(leftLocator, rightLocator, Float.floatToIntBits(left), - Float.floatToIntBits(right)); - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right) { - return left == right; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Equals[] left, Equals[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Enum[] left, Enum[] right) { - - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equalsInternal(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right) { - if (left == right) { - return true; - } - if (left == null || right == null) { - return false; - } - if (left.length != right.length) { - return false; - } - for (int i = 0; i < left.length; ++i) { - if (!equals(item(leftLocator, i, left[i]), - item(rightLocator, i, right[i]), left[i], right[i])) { - return false; - } - } - return true; - } - - public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java deleted file mode 100644 index e54659cd..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultHashCodeStrategy implements HashCodeStrategy { - - private int iConstant; - - public DefaultHashCodeStrategy() { - this.iConstant = 37; - } - - public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { - - if (multiplierNonZeroOddNumber == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires a non zero multiplier."); - } - if (multiplierNonZeroOddNumber % 2 == 0) { - throw new IllegalArgumentException( - "HashCodeStrategy requires an odd multiplier."); - } - this.iConstant = multiplierNonZeroOddNumber; - } - - public int hashCode(ObjectLocator locator, int hashCode, Object object) { - if (object == null) { - return hashCode * iConstant; - } else { - if (object.getClass().isArray() == false) { - return hashCodeInternal(locator, hashCode, object); - } else { - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays - if (object instanceof long[]) { - return hashCode(locator, hashCode, (long[]) object); - } else if (object instanceof int[]) { - return hashCode(locator, hashCode, (int[]) object); - } else if (object instanceof short[]) { - return hashCode(locator, hashCode, (short[]) object); - } else if (object instanceof char[]) { - return hashCode(locator, hashCode, (char[]) object); - } else if (object instanceof byte[]) { - return hashCode(locator, hashCode, (byte[]) object); - } else if (object instanceof double[]) { - return hashCode(locator, hashCode, (double[]) object); - } else if (object instanceof float[]) { - return hashCode(locator, hashCode, (float[]) object); - } else if (object instanceof boolean[]) { - return hashCode(locator, hashCode, (boolean[]) object); - } else if (object instanceof HashCode[]) { - return hashCodeInternal(locator, hashCode, (HashCode[]) object); - } else if (object instanceof Enum[]) { - return hashCodeInternal(locator, hashCode, (Enum[]) object); - } else { - // Not an array of primitives - return hashCode(locator, hashCode, (Object[]) object); - } - } - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else if (value instanceof Enum) { - return hashCodeInternal(locator, hashCode, (Enum) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum value) { - if (value == null) { - return hashCode * iConstant; - } else if (value instanceof HashCode) { - return hashCodeInternal(locator, hashCode, (HashCode) value); - } else { - return hashCode * iConstant + value.hashCode(); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode object) { - if (object == null) { - return hashCode * iConstant; - } else { - return hashCode * iConstant + object.hashCode(locator, this); - } - } - - - public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode * iConstant + 1; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCodeInternal(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean value) { - return hashCode * iConstant + (value ? 0 : 1); - - } - - public int hashCode(ObjectLocator locator, int hashCode, byte value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, char value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, double value) { - return hashCode(locator, hashCode, Double.doubleToLongBits(value)); - - } - - public int hashCode(ObjectLocator locator, int hashCode, float value) { - return hashCode(locator, hashCode, Float.floatToIntBits(value)); - } - - public int hashCode(ObjectLocator locator, int hashCode, int value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, long value) { - return hashCode * iConstant + ((int) (value ^ (value >> 32))); - - } - - public int hashCode(ObjectLocator locator, int hashCode, short value) { - return hashCode * iConstant + value; - - } - - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - } - - public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, char[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, double[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, float[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, int[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, long[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public int hashCode(ObjectLocator locator, int hashCode, short[] value) { - if (value == null) { - return hashCode * iConstant; - } else { - int currentHashCode = hashCode; - for (int i = 0; i < value.length; i++) { - currentHashCode = hashCode(item(locator, i, value[i]), - currentHashCode, value[i]); - } - return currentHashCode; - } - - } - - public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java deleted file mode 100644 index 53ffeea6..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultMergeStrategy implements MergeStrategy { - - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object leftValue, Object rightValue) { - if (leftValue == null) { - return rightValue; - } else if (rightValue == null) { - return leftValue; - } else { - if (leftValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) leftValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else if (rightValue instanceof MergeFrom) { - final Object newInstance = ((MergeFrom) rightValue) - .createNewInstance(); - ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, - leftValue, rightValue, this); - return newInstance; - } else { - return leftValue; - } - } - - } - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right) { - - if (left == null) { - return right; - } - if (right == null) { - return left; - } - Class lhsClass = left.getClass(); - if (!lhsClass.isArray()) { - return mergeInternal(leftLocator, rightLocator, left, right); - } else if (left.getClass() != right.getClass()) { - // Here when we compare different dimensions, for example: a - // boolean[][] to a boolean[] - return false; - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (left instanceof long[]) { - return merge(leftLocator, rightLocator, (long[]) left, - (long[]) right); - } else if (left instanceof int[]) { - return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); - } else if (left instanceof short[]) { - return merge(leftLocator, rightLocator, (short[]) left, - (short[]) right); - } else if (left instanceof char[]) { - return merge(leftLocator, rightLocator, (char[]) left, - (char[]) right); - } else if (left instanceof byte[]) { - return merge(leftLocator, rightLocator, (byte[]) left, - (byte[]) right); - } else if (left instanceof double[]) { - return merge(leftLocator, rightLocator, (double[]) left, - (double[]) right); - } else if (left instanceof float[]) { - return merge(leftLocator, rightLocator, (float[]) left, - (float[]) right); - } else if (left instanceof boolean[]) { - return merge(leftLocator, rightLocator, (boolean[]) left, - (boolean[]) right); - } else { - // Not an array of primitives - return merge(leftLocator, rightLocator, (Object[]) left, - (Object[]) right); - } - } - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long leftValue, long rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int leftValue, int rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short leftValue, short rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char leftValue, char rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte leftValue, byte rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double leftValue, double rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float leftValue, float rightValue) { - return leftValue != 0 ? leftValue : rightValue; - } - - public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - boolean leftValue, boolean rightValue) { - return leftValue ? leftValue : rightValue; - } - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] leftValue, long[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] leftValue, int[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short[] leftValue, short[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] leftValue, char[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] leftValue, byte[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float[] leftValue, float[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] leftValue, - boolean[] rightValue) { - if (leftValue != null) { - if (rightValue != null) { - return leftValue.length > 0 ? leftValue : rightValue; - - } else { - return leftValue; - } - } else { - return rightValue; - } - } - - public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java deleted file mode 100644 index c605261b..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java +++ /dev/null @@ -1,920 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class DefaultToStringStrategy implements ToStringStrategy { - - /** - * Whether to use the field names, the default is true. - */ - private boolean useFieldNames = true; - - /** - * Whether to use the class name, the default is true. - */ - private boolean useClassName = true; - - /** - * Whether to use short class names, the default is false. - */ - private boolean useShortClassName = false; - - /** - * Whether to use the identity hash code, the default is true. - */ - private boolean useIdentityHashCode = true; - - /** - * The content start '['. - */ - private String contentStart = "["; - - /** - * The content end ']'. - */ - private String contentEnd = "]"; - - /** - * The field name value separator '='. - */ - private String fieldNameValueSeparator = "="; - - /** - * Whether the field separator should be added before any other fields. - */ - private boolean fieldSeparatorAtStart = false; - - /** - * Whether the field separator should be added after any other fields. - */ - private boolean fieldSeparatorAtEnd = false; - - /** - * The field separator ','. - */ - private String fieldSeparator = ", "; - - /** - * The array start '{'. - */ - private String arrayStart = "{"; - - /** - * The array separator ','. - */ - private String arraySeparator = ","; - - /** - * The array end '}'. - */ - private String arrayEnd = "}"; - - /** - * The value to use when fullDetail is null, the default value - * is true. - */ - private boolean fullDetail = true; - - /** - * The null text '<null>'. - */ - private String nullText = ""; - - /** - * The summary size text start '. - */ - private String sizeStartText = "'>'. - */ - private String sizeEndText = ">"; - - public boolean isFullDetail() { - return fullDetail; - } - - public boolean isUseIdentityHashCode() { - return useIdentityHashCode; - } - - @SuppressWarnings("unchecked") - protected String getShortClassName(Class cls) { - return ClassUtils.getShortClassName(cls); - } - - /** - *

- * Append to the toString the class name. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose name to output - */ - protected void appendClassName(StringBuilder buffer, Object object) { - if (useClassName && object != null) { - if (useShortClassName) { - buffer.append(getShortClassName(object.getClass())); - } else { - buffer.append(object.getClass().getName()); - } - } - } - - /** - *

- * Append the {@link System#identityHashCode(java.lang.Object)}. - *

- * - * @param buffer - * the StringBuilder to populate - * @param object - * the Object whose id to output - */ - protected void appendIdentityHashCode(StringBuilder buffer, Object object) { - if (this.isUseIdentityHashCode() && object != null) { - buffer.append('@'); - buffer.append(Integer.toHexString(System.identityHashCode(object))); - } - } - - /** - *

- * Append to the toString the content start. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentStart(StringBuilder buffer) { - buffer.append(contentStart); - } - - /** - *

- * Append to the toString the content end. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendContentEnd(StringBuilder buffer) { - buffer.append(contentEnd); - } - - protected void appendArrayStart(StringBuilder buffer) { - buffer.append(arrayStart); - } - - protected void appendArrayEnd(StringBuilder buffer) { - buffer.append(arrayEnd); - } - - protected void appendArraySeparator(StringBuilder buffer) { - buffer.append(arraySeparator); - } - - /** - *

- * Append to the toString an indicator for null. - *

- * - *

- * The default indicator is '<null>'. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendNullText(StringBuilder buffer) { - buffer.append(nullText); - } - - /** - *

- * Append to the toString the field start. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name - */ - protected void appendFieldStart(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - if (useFieldNames && fieldName != null) { - buffer.append(fieldName); - buffer.append(fieldNameValueSeparator); - } - } - - /** - *

- * Append to the toString the field end. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - */ - protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer) { - appendFieldSeparator(buffer); - } - - /** - *

- * Append to the toString the field separator. - *

- * - * @param buffer - * the StringBuilder to populate - */ - protected void appendFieldSeparator(StringBuilder buffer) { - buffer.append(fieldSeparator); - } - - /** - *

- * Append to the toString a size summary. - *

- * - *

- * The size summary is used to summarize the contents of - * Collections, Maps and arrays. - *

- * - *

- * The output consists of a prefix, the passed in size and a suffix. - *

- * - *

- * The default format is '<size=n>'. - *

- * - * @param buffer - * the StringBuilder to populate - * @param propertyName - * the field name, typically not used as already appended - * @param size - * the size to append - */ - protected void appendSummarySize(ObjectLocator locator, - StringBuilder buffer, int size) { - buffer.append(sizeStartText); - buffer.append(size); - buffer.append(sizeEndText); - } - - public StringBuilder appendStart(ObjectLocator parentLocator, - Object object, StringBuilder buffer) { - if (object != null) { - appendClassName(buffer, object); - appendIdentityHashCode(buffer, object); - appendContentStart(buffer); - if (fieldSeparatorAtStart) { - appendFieldSeparator(buffer); - } - } - return buffer; - } - - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, - StringBuilder buffer) { - if (this.fieldSeparatorAtEnd == false) { - removeLastFieldSeparator(buffer); - } - appendContentEnd(buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, Object value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, boolean value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, double value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - Object[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator parentLocator, Object parent, - String fieldName, StringBuilder buffer, Collection value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - boolean[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, byte[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, char[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, - double[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, float[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, long[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, int[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - public StringBuilder appendField(ObjectLocator parentLocator, - Object parent, String fieldName, StringBuilder buffer, short[] value) { - appendFieldStart(parentLocator, parent, fieldName, buffer); - append(property(parentLocator, fieldName, value), buffer, value); - appendFieldEnd(parentLocator, parent, fieldName, buffer); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder buffer, Object value) { - if (value instanceof Collection) { - append(locator, buffer, (Collection) value); - } else if (value instanceof ToString) { - ((ToString) value).append(locator, buffer, this); - } else { - buffer.append(value.toString()); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object value) { - if (value == null) { - appendNullText(buffer); - } else { - Class theClass = value.getClass(); - if (!theClass.isArray()) { - appendInternal(locator, buffer, value); - } - // 'Switch' on type of array, to dispatch to the correct handler - // This handles multi dimensional arrays of the same depth - else if (value instanceof long[]) { - append(locator, buffer, (long[]) value); - } else if (value instanceof int[]) { - append(locator, buffer, (int[]) value); - } else if (value instanceof short[]) { - append(locator, buffer, (short[]) value); - } else if (value instanceof char[]) { - append(locator, buffer, (char[]) value); - } else if (value instanceof byte[]) { - append(locator, buffer, (byte[]) value); - } else if (value instanceof double[]) { - append(locator, buffer, (double[]) value); - } else if (value instanceof float[]) { - append(locator, buffer, (float[]) value); - } else if (value instanceof boolean[]) { - append(locator, buffer, (boolean[]) value); - } else { - // Not an array of primitives - append(locator, buffer, (Object[]) value); - } - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short value) { - buffer.append(value); - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Object[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - @SuppressWarnings("unchecked") - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - Collection array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - boolean[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - byte[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - char[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - double[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - float[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - int[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - long[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - public StringBuilder append(ObjectLocator locator, StringBuilder buffer, - short[] array) { - if (array == null) { - appendNullText(buffer); - - } else if (isFullDetail()) { - appendDetail(locator, buffer, array); - - } else { - appendSummary(locator, buffer, array); - } - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, char[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, double[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, float[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, int[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, long[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, short[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - appendSummarySize(locator, buffer, array.length); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendSummary(ObjectLocator locator, - StringBuilder buffer, Collection value) { - appendSummarySize(locator, buffer, value.size()); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, boolean[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, byte[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, char[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, double[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, float[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, int[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, long[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, short[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - if (i > 0) { - buffer.append(arraySeparator); - } - append(item(locator, i, array[i]), buffer, array[i]); - } - buffer.append(arrayEnd); - return buffer; - } - - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Object[] array) { - buffer.append(arrayStart); - for (int i = 0; i < array.length; i++) { - Object item = array[i]; - if (i > 0) { - buffer.append(arraySeparator); - } - if (item == null) { - appendNullText(buffer); - - } else { - append(item(locator, i, array[i]), buffer, array[i]); - } - } - buffer.append(arrayEnd); - return buffer; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendDetail(ObjectLocator locator, - StringBuilder buffer, Collection array) { - appendArrayStart(buffer); - int i = 0; - for (Object item : array) { - if (i > 0) { - appendArraySeparator(buffer); - } - append(item(locator, i, item), buffer, item); - i = i + 1; - } - appendArrayEnd(buffer); - return buffer; - } - - /** - *

- * Remove the last field separator from the buffer. - *

- * - * @param buffer - * the StringBuilder to populate - * @since 2.0 - */ - protected void removeLastFieldSeparator(StringBuilder buffer) { - int len = buffer.length(); - int sepLen = fieldSeparator.length(); - if (len > 0 && sepLen > 0 && len >= sepLen) { - boolean match = true; - for (int i = 0; i < sepLen; i++) { - if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen - - 1 - i)) { - match = false; - break; - } - } - if (match) { - buffer.setLength(len - sepLen); - } - } - } - - public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java deleted file mode 100644 index 9e843b88..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -public interface EnumValue { - - public T enumValue(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java deleted file mode 100644 index 0b4f545d..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface Equals { - - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, - Object that, EqualsStrategy equalsStrategy); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java deleted file mode 100644 index 339cbec6..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface EqualsStrategy { - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte left, byte right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char left, char right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double left, double right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float left, float right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int left, int right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long left, long right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short left, short right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, byte[] left, byte[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, char[] left, char[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, int[] left, int[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, long[] left, long[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java deleted file mode 100644 index 4651b164..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCode { - - public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java deleted file mode 100644 index a6c06704..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface HashCodeStrategy { - - public int hashCode(ObjectLocator locator, int hashCode, boolean value); - public int hashCode(ObjectLocator locator, int hashCode, byte value); - public int hashCode(ObjectLocator locator, int hashCode, char value); - public int hashCode(ObjectLocator locator, int hashCode, double value); - public int hashCode(ObjectLocator locator, int hashCode, float value); - public int hashCode(ObjectLocator locator, int hashCode, int value); - public int hashCode(ObjectLocator locator, int hashCode, long value); - public int hashCode(ObjectLocator locator, int hashCode, short value); - public int hashCode(ObjectLocator locator, int hashCode, Object value); - public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); - public int hashCode(ObjectLocator locator, int hashCode, byte[] value); - public int hashCode(ObjectLocator locator, int hashCode, char[] value); - public int hashCode(ObjectLocator locator, int hashCode, double[] value); - public int hashCode(ObjectLocator locator, int hashCode, float[] value); - public int hashCode(ObjectLocator locator, int hashCode, int[] value); - public int hashCode(ObjectLocator locator, int hashCode, long[] value); - public int hashCode(ObjectLocator locator, int hashCode, short[] value); - public int hashCode(ObjectLocator locator, int hashCode, Object[] value); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java deleted file mode 100644 index 01370b9b..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class JAXBCopyStrategy extends DefaultCopyStrategy { - @SuppressWarnings("unchecked") - @Override - protected Object copyInternal(ObjectLocator locator, Object object) { - if (object instanceof Node) { - final Node node = (Node) object; - return copyInternal(locator, node); - } else if (object instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) object; - return copyInternal(locator, jaxbElement); - } else if (object instanceof List) { - List list = (List) object; - return copyInternal(locator, list); - - } else - - { - return super.copyInternal(locator, object); - } - } - - protected Object copyInternal(ObjectLocator locator, final Node node) { - return node.cloneNode(true); - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, - final JAXBElement jaxbElement) { - final Object sourceObject = jaxbElement.getValue(); - final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); - final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), - jaxbElement.getDeclaredType(), jaxbElement.getScope(), - copyObject); - return copyElement; - } - - @SuppressWarnings("unchecked") - protected Object copyInternal(ObjectLocator locator, List list) { - final List copy = new ArrayList(list.size()); - for (int index = 0; index < list.size(); index++) { - final Object element = list.get(index); - final Object copyElement = copy(item(locator, index, element), element); - copy.add(copyElement); - } - return copy; - } - - public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java deleted file mode 100644 index 100e3ea8..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBEqualsStrategy extends DefaultEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { - final JAXBElement left = (JAXBElement) lhs; - final JAXBElement right = (JAXBElement) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else if (lhs instanceof List && rhs instanceof List) { - final List left = (List) lhs; - final List right = (List) rhs; - return equalsInternal(leftLocator, rightLocator, left, right); - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final List left, final List right) { - final Iterator e1 = left.iterator(); - final Iterator e2 = right.iterator(); - int index = 0; - while (e1.hasNext() && e2.hasNext()) { - Object o1 = e1.next(); - Object o2 = e2.next(); - if (!(o1 == null ? o2 == null : equals( - item(leftLocator, index, o1), item(rightLocator, index, - o2), o1, o2))) { - return false; - } - index = index + 1; - } - return !(e1.hasNext() || e2.hasNext()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, final JAXBElement left, - final JAXBElement right) { - return - // - equals(property(leftLocator, "name", left.getName()), property(rightLocator, - "name", right.getName()), left.getName(), right.getName()) - && - // - equals(property(leftLocator, "value", left.getValue()), property( - rightLocator, "name", right.getValue()), left - .getValue(), right.getValue()); - } - - public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java deleted file mode 100644 index 88b3cce7..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; -import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; - -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { - - public JAXBHashCodeStrategy() { - super(); - } - - public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { - super(multiplierNonZeroOddNumber); - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - Object value) { - if (value instanceof JAXBElement) { - final JAXBElement element = (JAXBElement) value; - return hashCodeInternal(locator, hashCode, element); - } else if (value instanceof List) { - final List list = (List) value; - return hashCodeInternal(locator, hashCode, list); - } else { - return super.hashCodeInternal(locator, hashCode, value); - } - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final JAXBElement element) { - int currentHashCode = hashCode; - currentHashCode = hashCode( - property(locator, "name", element.getName()), currentHashCode, - element.getName()); - currentHashCode = hashCode( - property(locator, "declaredType", element.getDeclaredType()), - currentHashCode, element.getDeclaredType()); - currentHashCode = hashCode( - property(locator, "scope", element.getScope()), - currentHashCode, element.getScope()); - currentHashCode = hashCode( - property(locator, "value", element.getValue()), - currentHashCode, element.getValue()); - return currentHashCode; - } - - protected int hashCodeInternal(ObjectLocator locator, int hashCode, - final List list) { - // Treat empty lists as nulls - if (list.isEmpty()) { - return super.hashCode(locator, hashCode, (Object) null); - } else { - int currentHashCode = hashCode; - for (int index = 0; index < list.size(); index++) { - final Object item = list.get(index); - currentHashCode = hashCode(item(locator, index, item), - currentHashCode, item); - } - return currentHashCode; - } - } - - public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java deleted file mode 100644 index 29f99fbb..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { - - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - - if (leftCollection instanceof List && rightCollection instanceof List) { - final List list = new ArrayList(leftCollection - .size() - + rightCollection.size()); - list.addAll(leftCollection); - list.addAll(rightCollection); - return list; - } else if (leftCollection instanceof Set - && rightCollection instanceof Set) { - final Set set = new HashSet(leftCollection.size() - + rightCollection.size()); - set.addAll(leftCollection); - set.addAll(rightCollection); - return set; - } else { - return super.mergeInternal(leftLocator, rightLocator, - leftCollection, rightCollection); - } - } - - public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java deleted file mode 100644 index 37232e26..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBMergeStrategy extends DefaultMergeStrategy { - - @SuppressWarnings("unchecked") - @Override - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right) { - if (left instanceof Collection && right instanceof Collection) { - Collection leftCollection = (Collection) left; - Collection rightCollection = (Collection) right; - return mergeInternal(leftLocator, rightLocator, leftCollection, - rightCollection); - } else { - return super.mergeInternal(leftLocator, rightLocator, left, right); - } - } - - @SuppressWarnings("unchecked") - protected Object mergeInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Collection leftCollection, - Collection rightCollection) { - return !leftCollection.isEmpty() ? leftCollection : rightCollection; - } - - public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java deleted file mode 100644 index afa9837e..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.bind.JAXBElement; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class JAXBToStringStrategy extends DefaultToStringStrategy { - - private String jaxbElementStart = "<"; - - private String jaxbElementEnd = ">"; - - protected void appendJAXBElementStart(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementStart); - } - - protected void appendJAXBElementEnd(StringBuilder stringBuilder) { - stringBuilder.append(jaxbElementEnd); - } - - @SuppressWarnings("unchecked") - @Override - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, Object value) { - if (value instanceof JAXBElement) { - final JAXBElement jaxbElement = (JAXBElement) value; - appendInternal(locator, stringBuilder, jaxbElement); - } else { - super.appendInternal(locator, stringBuilder, value); - } - return stringBuilder; - } - - @SuppressWarnings("unchecked") - protected StringBuilder appendInternal(ObjectLocator locator, - StringBuilder stringBuilder, JAXBElement value) { - appendJAXBElementStart(stringBuilder); - stringBuilder.append(value.getName()); - appendContentStart(stringBuilder); - append(locator, stringBuilder, value.getValue()); - appendContentEnd(stringBuilder); - appendJAXBElementEnd(stringBuilder); - return stringBuilder; - } - - public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java deleted file mode 100644 index 9811a10b..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeFrom { - - public Object createNewInstance(); - - public void mergeFrom(Object left, Object right); - - public void mergeFrom(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object left, Object right, - MergeStrategy mergeStrategy); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java deleted file mode 100644 index 4769c7a2..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface MergeStrategy { - - public boolean merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean left, boolean right); - - public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte left, byte right); - - public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char left, char right); - - public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - double left, double right); - - public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - float left, float right); - - public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int left, int right); - - public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long left, long right); - - public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - short left, short right); - - public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - Object left, Object right); - - public boolean[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, boolean[] left, boolean[] right); - - public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - byte[] left, byte[] right); - - public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - char[] left, char[] right); - - public double[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, double[] left, double[] right); - - public float[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, float[] left, float[] right); - - public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - int[] left, int[] right); - - public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, - long[] left, long[] right); - - public short[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, short[] left, short[] right); - - public Object[] merge(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object[] left, Object[] right); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java deleted file mode 100644 index 63f774eb..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class StringUtils { - public static final String LINE_SEPARATOR = System - .getProperty("line.separator"); - public static final String EMPTY = ""; - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - public static boolean isEmpty(String str) { - return str == null || str.length() == 0; - } - - public static String[] split(String str, char separatorChar) { - return splitWorker(str, separatorChar, false); - } - - @SuppressWarnings("unchecked") - private static String[] splitWorker(String str, char separatorChar, - boolean preserveAllTokens) { - // Performance tuned for 2.0 (JDK1.4) - - if (str == null) { - return null; - } - int len = str.length(); - if (len == 0) { - return EMPTY_STRING_ARRAY; - } - List list = new ArrayList(); - int i = 0, start = 0; - boolean match = false; - boolean lastMatch = false; - while (i < len) { - if (str.charAt(i) == separatorChar) { - if (match || preserveAllTokens) { - list.add(str.substring(start, i)); - match = false; - lastMatch = true; - } - start = ++i; - continue; - } - lastMatch = false; - match = true; - i++; - } - if (match || (preserveAllTokens && lastMatch)) { - list.add(str.substring(start, i)); - } - return (String[]) list.toArray(new String[list.size()]); - } - - @SuppressWarnings("unchecked") - public static String join(Iterator iterator, String separator) { - - // handle null, zero and one elements before building a buffer - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return EMPTY; - } - Object first = iterator.next(); - if (!iterator.hasNext()) { - return first == null ? "" : first.toString(); - } - - // two or more elements - StringBuilder buf = new StringBuilder(256); // Java default is 16, - // probably too small - if (first != null) { - buf.append(first); - } - - while (iterator.hasNext()) { - buf.append(separator); - Object obj = iterator.next(); - if (obj != null) { - buf.append(obj); - } - } - - return buf.toString(); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java deleted file mode 100644 index f98818d3..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToString { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - - public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, - ToStringStrategy toStringStrategy); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java deleted file mode 100644 index 1750d97e..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public interface ToStringStrategy { - - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); - public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); - - public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); - public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java deleted file mode 100644 index 7b4b6b52..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import java.util.Collection; -import java.util.Iterator; - -public class Validate { - - public static void notNull(Object object) { - if (object == null) { - throw new IllegalArgumentException("The validated object is null"); - } - } - - public static void isTrue(boolean expression) { - if (expression == false) { - throw new IllegalArgumentException( - "The validated expression is false"); - } - } - - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException( - "The validated collection is empty"); - } - } - - public static void noNullElements(Collection collection) { - Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { - if (it.next() == null) { - throw new IllegalArgumentException( - "The validated collection contains null element at index: " - + i); - } - } - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java deleted file mode 100644 index 8407ab35..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.net.URL; -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.w3c.dom.Node; - -/** - * Abstract base class for event locators. - * - * @author Aleksei Valikov - */ -public abstract class AbstractObjectLocator implements ObjectLocator { - /** - * Parent locator. - */ - protected final ObjectLocator parentLocator; - /** - * Object. - */ - protected final Object object; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected AbstractObjectLocator(final ObjectLocator parentLocator, - final Object object) { - this.object = object; - this.parentLocator = parentLocator; - } - - /** - * Returns parent locator. - * - * @return Parent locator. - */ - public ObjectLocator getParentLocator() { - return parentLocator; - } - - public ObjectLocator[] getPath() { - final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; - fillPath(this, path, path.length - 1); - return path; - } - - public String getPathAsString() { - final String stepAsString = getStepAsString(); - final ObjectLocator parentLocator = getParentLocator(); - return parentLocator == null ? stepAsString : parentLocator - .getPathAsString() + stepAsString; - } - - protected abstract String getStepAsString(); - - private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { - path[index] = locator; - final ObjectLocator parent = locator.getParentLocator(); - if (parent != null) - fillPath(parent, path, index - 1); - } - - private int getAncestorCount(ObjectLocator locator) { - final ObjectLocator parent = locator.getParentLocator(); - if (parent == null) - return 0; - else - return 1 + getAncestorCount(parent); - } - - public Object getObject() { - return object; - } - - public int getColumnNumber() { - return 0; - } - - public int getLineNumber() { - return 0; - } - - public int getOffset() { - return 0; - } - - public URL getURL() { - return null; - } - - public Node getNode() { - return null; - } - - // /** - // * Returns expression step (for EL and JXPath expressions). - // * @return Expression step. - // */ - // public abstract String getStep(); - - public String toString() { - return getMessage(); - } - - /** - * Returns message code. - * - * @return Message code. - */ - public String getMessageCode() { - return getClass().getName(); - } - - protected abstract String getDefaultMessage(); - - // public Object[] getMessageParameters() { - // return new Object[] { getObject() }; - // } - // - public String getMessage(ResourceBundle bundle) { - try { - final String messageTemplate = bundle.getString(getMessageCode()); - return MessageFormat - .format(messageTemplate, getMessageParameters()); - } catch (MissingResourceException mrex) { - return getDefaultMessage(); - } - } - - /** - * Returns location message. - * - * @return Location message. - */ - public String getMessage() { - return getMessage(ResourceBundle.getBundle(getClass().getPackage() - .getName() + ".messages")); - } - - // public int hashCode() { - // int hashCode = getObject().hashCode(); - // return hashCode; - // } - - public ItemObjectLocator item(int index, Object value) { - return new DefaultItemObjectLocator(this, index, value); - } - - public PropertyObjectLocator property(String name, Object value) { - return new DefaultPropertyObjectLocator(this, name, value); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java deleted file mode 100644 index ce0d32ff..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Locator for the collection item. - */ -public final class DefaultItemObjectLocator extends AbstractObjectLocator - implements ItemObjectLocator { - /** - * Item index. - */ - protected final int index; - - /** - * Constructs a new item locator. - * - * @param parentLocator - * parent locator. - * @param itemIndex - * item index. - * @param itemValue - * item value. - */ - protected DefaultItemObjectLocator(final ObjectLocator parentLocator, - final int itemIndex, Object itemValue) { - super(parentLocator, itemValue); - this.index = itemIndex; - } - - /** - * Returns item index. - * - * @return Index of the item. - */ - public int getIndex() { - return index; - } - - public Object[] getMessageParameters() { - return new Object[] { getObject(), Integer.valueOf(getIndex()) }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Item index: {1}\nItem value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "[" + getIndex() + "]"; - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java deleted file mode 100644 index 0484223a..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -/** - * Validation event locator. - * - * @author Aleksei Valikov - */ -public final class DefaultPropertyObjectLocator extends AbstractObjectLocator - implements PropertyObjectLocator { - - /** - * Field name. - */ - protected final String propertyName; - - /** - * Constructs a new validation event locator. - * - * @param parentLocator - * parent location (may be null). - * @param object - * object. - * @param propertyName - * field name. - */ - protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, - final String propertyName, final Object propertyValue) { - super(parentLocator, propertyValue); - this.propertyName = propertyName; - } - - public String getPropertyName() { - return propertyName; - } - - /** - * Returns parameters for message formatting. - * - * @return Message formatting parameters. - */ - public Object[] getMessageParameters() { - return new Object[] { getObject(), getPropertyName() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat.format("Field: {1}\nField value: {0}.", - getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return "." + getPropertyName(); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java deleted file mode 100644 index ecd6fc3e..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import java.text.MessageFormat; - -public final class DefaultRootObjectLocator extends AbstractObjectLocator - implements RootObjectLocator { - - public DefaultRootObjectLocator(Object rootObject) { - super(null, rootObject); - } - - public Object[] getMessageParameters() { - return new Object[] { getObject() }; - } - - @Override - protected String getDefaultMessage() { - return MessageFormat - .format("Root object: {0}.", getMessageParameters()); - } - - @Override - protected String getStepAsString() { - return ""; - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java deleted file mode 100644 index 1fb846f6..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models item locator. - * - * @author Aleksei Valikov - * - */ -public interface ItemObjectLocator extends ObjectLocator { - - /** - * @return Item index. - */ - public int getIndex(); - - /** - * @return Item value. - */ - public Object getObject(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java deleted file mode 100644 index 37aa8555..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -import javax.xml.bind.ValidationEventLocator; - -import org.jvnet.jaxb2_commons.i18n.Reportable; - -/** - * Object locator denotes a location in an object structure. - * - * @author Aleksei Valikov - * - */ -public interface ObjectLocator extends ValidationEventLocator, Reportable { - - /** - * @return Parent locator, may be null. - */ - public ObjectLocator getParentLocator(); - - /** - * @return Path to this locator from the root. - */ - public ObjectLocator[] getPath(); - - /** - * @return Path to this locator in string form; - */ - public String getPathAsString(); - - /** - * Creates a locator for the property, relative to this locator. - * - * @param propertyName - * name of the property, must not be null. - * @param propertyValue - * value of the property, may be null. - * @return Child property locator. - */ - public PropertyObjectLocator property(String propertyName, - Object propertyValue); - - /** - * Creates a locator for the item (like list or array item) relative to this - * locator. - * - * @param itemIndex - * index of the item. - * @param itemValue - * value of the item. - * @return Child item locator. - */ - public ItemObjectLocator item(int itemIndex, Object itemValue); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java deleted file mode 100644 index ca6ff4fb..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -/** - * Models a property locator. - * - * @author Aleksei Valikov - * - */ -public interface PropertyObjectLocator extends ObjectLocator { - - /** - * @return Name of the property. - */ - public String getPropertyName(); - - /** - * @return Returns value of the property. - */ - public Object getObject(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java deleted file mode 100644 index da5514b4..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.locator; - -public interface RootObjectLocator extends ObjectLocator { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java deleted file mode 100644 index c014682f..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.jvnet.jaxb2_commons.locator.util; - -import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; -import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.xml.sax.Locator; - -public class LocatorUtils { - - private LocatorUtils() { - - } - - public static String getLocation(Locator locator) { - if (locator == null) { - return ""; - } else { - return locator.getPublicId() + ":" + locator.getSystemId() + ":" - + locator.getLineNumber() + ":" + locator.getColumnNumber(); - } - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - Object value) { - return locator == null ? null : locator.property(name, value); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - boolean value) { - return locator == null ? null : locator.property(name, Boolean - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - byte value) { - return locator == null ? null : locator - .property(name, Byte.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - char value) { - return locator == null ? null : locator.property(name, Character - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - double value) { - return locator == null ? null : locator.property(name, Double - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - float value) { - return locator == null ? null : locator.property(name, Float - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - int value) { - return locator == null ? null : locator.property(name, Integer - .valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - long value) { - return locator == null ? null : locator - .property(name, Long.valueOf(value)); - } - - public static PropertyObjectLocator property(ObjectLocator locator, String name, - short value) { - return locator == null ? null : locator.property(name, Short - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, Object value) { - return locator == null ? null : locator.item(index, value); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, boolean value) { - return locator == null ? null : locator.item(index, Boolean - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, byte value) { - return locator == null ? null : locator.item(index, Byte - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, char value) { - return locator == null ? null : locator.item(index, Character - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, double value) { - return locator == null ? null : locator.item(index, Double - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, float value) { - return locator == null ? null : locator.item(index, Float - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, int value) { - return locator == null ? null : locator.item(index, Integer - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, long value) { - return locator == null ? null : locator.item(index, Long - .valueOf(value)); - } - - public static ItemObjectLocator item(ObjectLocator locator, - int index, short value) { - return locator == null ? null : locator.item(index, Short - .valueOf(value)); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java deleted file mode 100644 index 778fa8fe..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface AfterMarshallCallback { - - public void afterMarshal(Marshaller marshaller); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java deleted file mode 100644 index cc4ba9a2..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface AfterUnmarshallCallback { - - public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java deleted file mode 100644 index aaad6e34..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Marshaller; - -public interface BeforeMarshallCallback { - - public void beforeMarshal(Marshaller marshaller); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java deleted file mode 100644 index 34b706bc..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - -import javax.xml.bind.Unmarshaller; - -public interface BeforeUnmarshallCallback { - - public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java deleted file mode 100644 index 8b6c22f1..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind; - - -/** - * Implemented by classes which are aware of JAXB context path. - * - * @author valikov - */ -public interface ContextPathAware { - - /** - * Returns JAXB context path which could be used to - * create a JAXBContext instance. - * - * @return JAXB context path. - */ - public String getContextPath(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java deleted file mode 100644 index dde588d2..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import org.jvnet.jaxb2_commons.lang.StringUtils; - -public class CommaDelimitedStringAdapter extends - XmlAdapter> { - - @Override - public String marshal(List value) throws Exception { - if (value == null) { - return null; - } else { - return StringUtils.join(value.iterator(), ", "); - } - } - - @Override - public List unmarshal(String text) throws Exception { - - if (text == null) { - return null; - } else - - { - final List value = new LinkedList(); - final String[] items = StringUtils.split(text, ','); - for (String item : items) { - final String trimmedItem = item.trim(); - if (!StringUtils.isEmpty(trimmedItem)) { - value.add(trimmedItem); - } - } - return value; - } - } - -} \ No newline at end of file diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java deleted file mode 100644 index a1351b5b..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyAttributePropertyInfo extends MPropertyInfo { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java deleted file mode 100644 index b6e118c6..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MAnyElementPropertyInfo extends MPropertyInfo, - MWildcard, MMixable { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java deleted file mode 100644 index 511d0c91..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MAttributePropertyInfo extends - MSingleTypePropertyInfo { - - public QName getAttributeName(); - -} \ No newline at end of file diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java deleted file mode 100644 index 38c99e38..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MBuiltinLeafInfo extends MTypeInfo, - MOriginated { - - public QName getTypeName(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java deleted file mode 100644 index 57cecb8e..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MClassInfo extends MClassTypeInfo, - MOriginated { - - public MClassTypeInfo getBaseTypeInfo(); - - public List> getProperties(); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - - public void addProperty(MPropertyInfo propertyInfo); - - public void removeProperty(MPropertyInfo propertyInfo); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java deleted file mode 100644 index 963d4734..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassRef extends MClassTypeInfo { -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java deleted file mode 100644 index fb396a97..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassTypeInfo extends MPackagedTypeInfo, - MContainer { - - public C getTargetClass(); - - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java deleted file mode 100644 index 47d7b23e..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MClassTypeInfoVisitor { - - public V visitClassInfo(MClassInfo info); - - public V visitClassRef(MClassRef info); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java deleted file mode 100644 index 73f92248..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContained { - - public MContainer getContainer(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java deleted file mode 100644 index e55cac10..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MContainer extends MPackaged { - - public String getLocalName(); - - public String getContainerLocalName(String delimiter); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java deleted file mode 100644 index 1a673485..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomizable { - - public MCustomizations getCustomizations(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java deleted file mode 100644 index 3e32cc52..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MCustomization { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java deleted file mode 100644 index b20537dc..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MCustomizations { - - public List getCustomizations(); - - public void addCustomization(MCustomization customization); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java deleted file mode 100644 index 6c72d310..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MElementInfo extends MElementTypeInfo, MPackaged, - MOriginated, MContained, MContainer { - - public QName getElementName(); - - public MTypeInfo getScope(); - - public QName getSubstitutionHead(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java deleted file mode 100644 index a32a119d..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfo { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java deleted file mode 100644 index 31674df5..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MElementRefPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfo { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java deleted file mode 100644 index 521be21c..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementRefsPropertyInfo extends MPropertyInfo, - MMixable, MWrappable, MWildcard, MElementTypeInfos { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java deleted file mode 100644 index ce395688..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MElementTypeInfo extends MTyped { - - public QName getElementName(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java deleted file mode 100644 index b808a754..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -public interface MElementTypeInfos { - public List> getElementTypeInfos(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java deleted file mode 100644 index 2ce0aabd..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - - -public interface MElementsPropertyInfo extends MPropertyInfo, - MWrappable, MElementTypeInfos { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java deleted file mode 100644 index d21cf159..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumConstantInfo extends - MOriginated { - - public String getLexicalValue(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java deleted file mode 100644 index 1c109cb5..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MEnumLeafInfo extends MPackagedTypeInfo, - MOriginated { - - public C getTargetClass(); - - public MTypeInfo getBaseTypeInfo(); - - public List> getConstants(); - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); - - public QName getElementName(); - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java deleted file mode 100644 index 4a43b435..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MID extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java deleted file mode 100644 index 49ca1c30..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREF extends MTypeInfo { - - public MTypeInfo getValueTypeInfo(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java deleted file mode 100644 index 1f0b2084..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MIDREFS extends MList { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java deleted file mode 100644 index db799c8d..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MList extends MTypeInfo { - - public MTypeInfo getItemTypeInfo(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java deleted file mode 100644 index 6a800127..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MMixable { - - public boolean isMixed(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java deleted file mode 100644 index 9e0b5b8c..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; - -public interface MModelInfo extends MCustomizable, - MOriginated { - - public Collection> getBuiltinLeafInfos(); - - public Collection> getClassInfos(); - - public Collection> getEnumLeafInfos(); - - public Collection> getTypeInfos(); - - public Collection> getElementInfos(); - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); - - public void addClassInfo(MClassInfo classInfo); - - public void removeClassInfo(MClassInfo classInfo); - - public void addElementInfo(MElementInfo elementInfo); - - public void removeElementInfo(MElementInfo elementInfo); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java deleted file mode 100644 index 6ea7fe61..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public interface MPackageInfo extends MOriginated, - MContainer { - - public String getPackageName(); - - public String getPackagedName(String localName); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java deleted file mode 100644 index c4d7fdce..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackaged { - - public MPackageInfo getPackageInfo(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java deleted file mode 100644 index 7c7571b9..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPackagedTypeInfo extends MTypeInfo, MPackaged, - MContained { - - public String getName(); - - public String getLocalName(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java deleted file mode 100644 index 0d628be5..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public abstract class MPackagedTypeInfoVisitor implements - MTypeInfoVisitor { - - public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); - - public V visitList(MList info) { - return null; - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return null; - } - - public V visitID(MID info) { - return null; - } - - public V visitIDREF(MIDREF info) { - return null; - } - - public V visitIDREFS(MIDREFS info) { - return null; - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitPackagedTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return null; - } - - public V visitClassInfo(MClassInfo info) { - return visitPackagedTypeInfo(info); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java deleted file mode 100644 index afd6e44d..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public interface MPropertyInfo extends MOriginated { - - public MClassInfo getClassInfo(); - - public String getPrivateName(); - - public String getPublicName(); - - public boolean isCollection(); - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java deleted file mode 100644 index 5120cc24..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MPropertyInfoVisitor { - - public V visitElementPropertyInfo(MElementPropertyInfo info); - - public V visitElementsPropertyInfo(MElementsPropertyInfo info); - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); - - public V visitAttributePropertyInfo(MAttributePropertyInfo info); - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); - - public V visitValuePropertyInfo(MValuePropertyInfo info); - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java deleted file mode 100644 index d4993cae..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSingleTypePropertyInfo extends MPropertyInfo, - MTyped { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java deleted file mode 100644 index a7c4dfbb..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MSourced { - - public S getSource(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java deleted file mode 100644 index f6b70a97..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTargeted { - - public T getTarget(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java deleted file mode 100644 index 8d4429d2..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTransientPropertyInfo { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java deleted file mode 100644 index 98a86bc7..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfo extends MCustomizable { - - public T getTargetType(); - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java deleted file mode 100644 index 8b2d1e4b..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTypeInfoVisitor extends - MClassTypeInfoVisitor { - - public V visitList(MList info); - - public V visitID(MID info); - - public V visitIDREF(MIDREF info); - - public V visitIDREFS(MIDREFS info); - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); - - public V visitEnumLeafInfo(MEnumLeafInfo info); - - public V visitWildcardTypeInfo(MWildcardTypeInfo info); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java deleted file mode 100644 index 66d508d9..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MTyped { - - public MTypeInfo getTypeInfo(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java deleted file mode 100644 index 0cbd24c1..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MValuePropertyInfo extends MSingleTypePropertyInfo { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java deleted file mode 100644 index 8a206c60..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -public interface MWildcard { - - public boolean isDomAllowed(); - - public boolean isTypedObjectAllowed(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java deleted file mode 100644 index b478608d..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public interface MWildcardTypeInfo extends MTypeInfo, - MOriginated { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java deleted file mode 100644 index 58ff3b73..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model; - -import javax.xml.namespace.QName; - -public interface MWrappable { - - public QName getWrapperElementName(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java deleted file mode 100644 index d201b8e2..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfo extends CMPropertyInfo - implements MAnyAttributePropertyInfo { - - public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName) { - super(origin, classInfo, privateName, false); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyAttributePropertyInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java deleted file mode 100644 index f66b70ee..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyElementPropertyInfo extends CMPropertyInfo - implements MAnyElementPropertyInfo { - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAnyElementPropertyInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java deleted file mode 100644 index 83177775..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAttributePropertyInfo extends - CMSingleTypePropertyInfo implements MAttributePropertyInfo { - - private final QName attributeName; - - public CMAttributePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo, QName attributeName) { - super(origin, classInfo, privateName, false, typeInfo); - Validate.notNull(attributeName); - this.attributeName = attributeName; - } - - public QName getAttributeName() { - return attributeName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitAttributePropertyInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java deleted file mode 100644 index 6dd77b37..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { - - private final MBuiltinLeafInfoOrigin origin; - private final T targetType; - private final QName typeName; - private final MCustomizations customizations = new CMCustomizations(); - - public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, - QName typeName) { - Validate.notNull(origin); - Validate.notNull(targetType); - Validate.notNull(typeName); - this.origin = origin; - this.targetType = targetType; - this.typeName = typeName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MBuiltinLeafInfoOrigin getOrigin() { - return origin; - } - - public QName getTypeName() { - return typeName; - } - - public String toString() { - return "BuiltinLeafInfo [" + getTypeName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitBuiltinLeafInfo(this); - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java deleted file mode 100644 index bdc4a89a..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMClassInfo implements MClassInfo { - - private final MClassInfoOrigin origin; - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - private final MClassTypeInfo baseTypeInfo; - private final QName elementName; - - private List> properties = new ArrayList>(); - private List> unmodifiableProperties = Collections - .unmodifiableList(properties); - - public CMClassInfo(MClassInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MClassTypeInfo baseTypeInfo, QName elementName) { - super(); - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - this.baseTypeInfo = baseTypeInfo; - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MClassInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), getContainer(), getLocalName(), - getElementName(), scope, this, substitutionHead); - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MContainer getScope() { - return container; - } - - public MClassTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getProperties() { - return unmodifiableProperties; - } - - public QName getElementName() { - return elementName; - } - - public void addProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.add(propertyInfo); - } - - @SuppressWarnings("unchecked") - public void removeProperty(MPropertyInfo propertyInfo) { - Validate.notNull(propertyInfo); - this.properties.remove(propertyInfo); - - if (getOrigin() instanceof ClassInfoOrigin - && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { - ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) - .getSource(); - PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo - .getOrigin()).getSource(); - ci.getProperties().remove(pi); - } - } - - public String toString() { - return "ClassInfo [" + getName() + "]"; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } - - @Override - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor) { - return visitor.visitClassInfo(this); - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java deleted file mode 100644 index a64ba452..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMClassRef implements MClassRef { - - private CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final String name; - private final String localName; - private final MContainer container; - - public CMClassRef(/* MClassInfoOrigin origin, */C targetClass, - MPackageInfo _package, MContainer container, String localName) { - super(); - // Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - // this.origin = origin; - this.targetClass = targetClass; - this.name = _package.getPackagedName(localName); - this.localName = localName; - this._package = _package; - this.container = container; - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - public T getTargetType() { - return targetClass; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitClassRef(this); - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public C getTargetClass() { - return targetClass; - } - - @Override - public V acceptClassTypeInfoVisitor( - MClassTypeInfoVisitor visitor) { - return visitor.visitClassRef(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java deleted file mode 100644 index 6e09ab64..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.w3c.dom.Element; - -public class CMCustomization implements MCustomization { - - private final Element element; - - public CMCustomization(Element element) { - this.element = element; - } - - public Element getElement() { - return element; - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java deleted file mode 100644 index c7bfa857..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; - -public class CMCustomizations implements MCustomizations { - - private final List customizations = new LinkedList(); - private final List unmodifiableCustomizations = Collections - .unmodifiableList(this.customizations); - - public List getCustomizations() { - return unmodifiableCustomizations; - } - - public void addCustomization(MCustomization customization) { - Validate.notNull(customization); - this.customizations.add(customization); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java deleted file mode 100644 index e539fd75..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -public class CMElementInfo implements MElementInfo { - - private final MElementInfoOrigin origin; - - private final MPackageInfo _package; - - private final MContainer container; - - private final String localName; - - private final QName elementName; - - private final MTypeInfo scope; - - private final MTypeInfo typeInfo; - - private final QName substitutionHead; - - public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, - MContainer container, String localName, QName elementName, - MTypeInfo scope, MTypeInfo typeInfo, - QName substitutionHead) { - super(); - Validate.notNull(origin); - Validate.notNull(elementName); - Validate.notNull(_package); - this.origin = origin; - this._package = _package; - this.container = container; - this.localName = localName; - this.elementName = elementName; - this.scope = scope; - this.typeInfo = typeInfo; - this.substitutionHead = substitutionHead; - } - - public MElementInfoOrigin getOrigin() { - return origin; - } - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getLocalName() { - return localName; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getScope() { - return scope; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getSubstitutionHead() { - return substitutionHead; - } - - public String toString() { - return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), - getTypeInfo()); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java deleted file mode 100644 index e101c771..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementPropertyInfo extends CMPropertyInfo implements - MElementPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - public CMElementPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementPropertyInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java deleted file mode 100644 index 7d40320f..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefPropertyInfo extends CMPropertyInfo - implements MElementRefPropertyInfo { - - private final MTypeInfo typeInfo; - private final QName elementName; - private final QName wrapperElementName; - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo, QName elementName, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - this.typeInfo = typeInfo; - this.elementName = elementName; - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefPropertyInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java deleted file mode 100644 index aa7c8693..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementRefsPropertyInfo extends CMPropertyInfo - implements MElementRefsPropertyInfo { - - private final QName wrapperElementName; - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - - private final boolean mixed; - private final boolean domAllowed; - private final boolean typedObjectAllowed; - - public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName, boolean mixed, boolean domAllowed, - boolean typedObjectAllowed) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); -// Validate.notEmpty(elementTypeInfos); -// Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - this.mixed = mixed; - this.domAllowed = domAllowed; - this.typedObjectAllowed = typedObjectAllowed; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public boolean isMixed() { - return mixed; - } - - public boolean isDomAllowed() { - return domAllowed; - } - - public boolean isTypedObjectAllowed() { - return typedObjectAllowed; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementRefsPropertyInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java deleted file mode 100644 index 023c813f..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; - -public class CMElementTypeInfo implements MElementTypeInfo { - - private final QName elementName; - - private final MTypeInfo typeInfo; - - public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { - Validate.notNull(elementName); - Validate.notNull(typeInfo); - this.elementName = elementName; - this.typeInfo = typeInfo; - } - - public QName getElementName() { - return elementName; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public String toString() { - return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java deleted file mode 100644 index 34df99d1..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMElementsPropertyInfo extends CMPropertyInfo - implements MElementsPropertyInfo { - - private final List> elementTypeInfos = new ArrayList>(); - private final List> unmodifiableElementTypeInfos = Collections - .unmodifiableList(elementTypeInfos); - private final QName wrapperElementName; - - public CMElementsPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - Collection> elementTypeInfos, - QName wrapperElementName) { - super(origin, classInfo, privateName, collection); - Validate.noNullElements(elementTypeInfos); - Validate.notEmpty(elementTypeInfos); - Validate.isTrue(elementTypeInfos.size() > 1); - this.elementTypeInfos.addAll(elementTypeInfos); - this.wrapperElementName = wrapperElementName; - } - - public List> getElementTypeInfos() { - return unmodifiableElementTypeInfos; - } - - public QName getWrapperElementName() { - return wrapperElementName; - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitElementsPropertyInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java deleted file mode 100644 index 85f000c3..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -public class CMEnumConstantInfo implements MEnumConstantInfo { - - private final MEnumConstantInfoOrigin origin; - private final MEnumLeafInfo enumLeafInfo; - private final String lexicalValue; - - public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, - MEnumLeafInfo enumLeafInfo, String lexicalValue) { - Validate.notNull(origin); - Validate.notNull(enumLeafInfo); - Validate.notNull(lexicalValue); - this.origin = origin; - this.enumLeafInfo = enumLeafInfo; - this.lexicalValue = lexicalValue; - } - - public MEnumConstantInfoOrigin getOrigin() { - return origin; - } - - public MEnumLeafInfo getEnumLeafInfo() { - return enumLeafInfo; - } - - public String getLexicalValue() { - return lexicalValue; - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java deleted file mode 100644 index 47a598a2..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfo implements MEnumLeafInfo, - MCustomizable { - - private final MEnumLeafInfoOrigin origin; - private final CMCustomizations customizations = new CMCustomizations(); - private final C targetClass; - private final MPackageInfo _package; - private final MContainer container; - private final String name; - private final String localName; - private final MTypeInfo baseTypeInfo; - private final List> constants = new ArrayList>(); - private final List> _constants = Collections - .unmodifiableList(constants); - private final QName elementName; - - public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, - MPackageInfo _package, MContainer container, String localName, - MTypeInfo baseTypeInfo, QName elementName) { - - Validate.notNull(origin); - Validate.notNull(targetClass); - Validate.notNull(_package); - Validate.notNull(localName); - Validate.notNull(baseTypeInfo); - this.origin = origin; - this.targetClass = targetClass; - this._package = _package; - this.container = container; - this.localName = localName; - this.name = _package.getPackagedName(localName); - this.baseTypeInfo = baseTypeInfo; - // May be null - this.elementName = elementName; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MEnumLeafInfoOrigin getOrigin() { - return origin; - } - - public C getTargetClass() { - return targetClass; - } - - public T getTargetType() { - return targetClass; - } - - public MElementInfo createElementInfo(MTypeInfo scope, - QName substitutionHead) { - return new CMElementInfo(getOrigin().createElementInfoOrigin(), - getPackageInfo(), - getContainer(), - getLocalName(), - getElementName(), scope, this, - substitutionHead); - } - - public String getName() { - return name; - } - - public String getLocalName() { - return localName; - } - - - public MPackageInfo getPackageInfo() { - return _package; - } - - public MContainer getContainer() { - return container; - } - - public String getContainerLocalName(String delimiter) { - final String localName = getLocalName(); - if (localName == null) { - return null; - } else { - final MContainer container = getContainer(); - if (container == null) { - return localName; - } else { - final String containerLocalName = container - .getContainerLocalName(delimiter); - return containerLocalName == null ? localName - : containerLocalName + delimiter + localName; - } - } - } - - public MTypeInfo getBaseTypeInfo() { - return baseTypeInfo; - } - - public List> getConstants() { - return _constants; - } - - public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - this.constants.add(enumConstantInfo); - } - - @SuppressWarnings("unchecked") - public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { - Validate.notNull(enumConstantInfo); - - if (getOrigin() instanceof EnumLeafInfoOrigin - && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { - // TODO - EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) - .getSource(); - EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo - .getOrigin()).getSource(); - - Iterator iterator = eli.getConstants().iterator(); - - while (iterator.hasNext()) { - if (iterator.next() == ec) { - iterator.remove(); - } - } - } - // TODO Auto-generated method stub - - } - - public QName getElementName() { - return elementName; - } - - @Override - public String toString() { - return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitEnumLeafInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java deleted file mode 100644 index 5daa634c..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMID implements MID { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMID(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitID(this); - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java deleted file mode 100644 index 2eaeacde..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; - -public class CMIDREF implements MIDREF { - - private final MTypeInfo valueTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMIDREF(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.valueTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getValueTypeInfo() { - return valueTypeInfo; - } - - public QName getTypeName() { - return XmlSchemaConstants.ID; - } - - @Override - public String toString() { - return MessageFormat.format("ID [{0}]", getValueTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREF(this); - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java deleted file mode 100644 index accf9d52..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMIDREFS extends CMList implements MIDREFS { - - public CMIDREFS(T targetType, MTypeInfo itemTypeInfo) { - super(targetType, itemTypeInfo); - } - - @Override - public String toString() { - return MessageFormat.format("IDREFS [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitIDREFS(this); - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java deleted file mode 100644 index 49521b5d..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java +++ /dev/null @@ -1,538 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.activation.MimeType; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.Adapter; -import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.Element; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.bind.v2.model.core.EnumConstant; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.bind.v2.model.core.PropertyInfo; -import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.bind.v2.model.core.TypeInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.bind.v2.model.core.TypeRef; -import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public abstract class CMInfoFactory, -// -TI extends TypeInfo, -// -BLI extends BuiltinLeafInfo, -// -EI extends ElementInfo, -// -ELI extends EnumLeafInfo, -// -EC extends EnumConstant, -// -CI extends ClassInfo, -// -PI extends PropertyInfo, -// -API extends AttributePropertyInfo, -// -VPI extends ValuePropertyInfo, -// -EPI extends ElementPropertyInfo, -// -RPI extends ReferencePropertyInfo, -// -WTI extends WildcardTypeInfo> { - - private final Map> builtinLeafInfos = new IdentityHashMap>(); - - private final Map> classInfos = new IdentityHashMap>(); - - private final Map> enumLeafInfos = new IdentityHashMap>(); - - private final Map> elementInfos = new IdentityHashMap>(); - - private final TIS typeInfoSet; - - public CMInfoFactory(TIS typeInfoSet) { - Validate.notNull(typeInfoSet); - this.typeInfoSet = typeInfoSet; - - } - - public MModelInfo createModel() { - final CMModel model = new CMModel( - createModelInfoOrigin(typeInfoSet)); - - createBuiltinLeafInfos(model); - createEnumLeafInfos(model); - createClassInfos(model); - createElementInfos(model); - return model; - - } - - private void createElementInfos(final CMModel model) { - Iterable> elements = typeInfoSet - .getAllElements(); - for (ElementInfo element : elements) { - final EI ei = (EI) element; - elementInfos.put(ei, createElementInfo(ei)); - } - for (ElementInfo element : elements) { - model.addElementInfo(getElementInfo((EI) element)); - } - } - - private void createEnumLeafInfos(final CMModel model) { - Collection> enums = typeInfoSet.enums() - .values(); - for (EnumLeafInfo enumLeafInfo : enums) { - @SuppressWarnings("unchecked") - final ELI eli = (ELI) enumLeafInfo; - enumLeafInfos.put(eli, createEnumLeafInfo(eli)); - } - for (Map.Entry> entry : enumLeafInfos - .entrySet()) { - populateEnumLeafInfo(entry.getKey(), entry.getValue()); - } - for (EnumLeafInfo enumLeafInfo : enums) { - model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); - } - } - - private void createBuiltinLeafInfos(final CMModel model) { - Collection> builtins = typeInfoSet - .builtins().values(); - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - @SuppressWarnings("unchecked") - final BLI bli = (BLI) builtinLeafInfo; - builtinLeafInfos.put(bli, createBuiltinLeafInfo(bli)); - } - for (BuiltinLeafInfo builtinLeafInfo : builtins) { - model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); - } - } - - private void createClassInfos(final CMModel model) { - Collection> beans = typeInfoSet.beans() - .values(); - - for (ClassInfo classInfo : beans) { - @SuppressWarnings("unchecked") - final CI ci = (CI) classInfo; - classInfos.put(ci, createClassInfo(ci)); - } - for (Map.Entry> entry : classInfos.entrySet()) { - populateClassInfo(entry.getKey(), entry.getValue()); - } - for (ClassInfo classInfo : beans) { - model.addClassInfo(getTypeInfo((CI) classInfo)); - } - } - - protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, - TI typeInfo, boolean list, Adapter adapter, ID id, - MimeType mimeType) { - final MTypeInfo ti = getTypeInfo(typeInfo); - - if (list) { - switch (id) { - case ID: - final MTypeInfo tid = new CMID(ti.getTargetType(), - ti); - return new CMList(createListType(tid.getTargetType()), - tid); - case IDREF: - return new CMIDREFS(createListType(ti.getTargetType()), - ti); - default: - return new CMList(createListType(ti.getTargetType()), ti); - } - } else { - switch (id) { - case ID: - return new CMID(ti.getTargetType(), ti); - case IDREF: - return new CMIDREF(ti.getTargetType(), ti); - default: - return ti; - } - } - - } - - protected MTypeInfo getTypeInfo(TI typeInfo) { - if (typeInfo instanceof BuiltinLeafInfo) { - return getTypeInfo((BLI) typeInfo); - } else if (typeInfo instanceof EnumLeafInfo) { - return getTypeInfo((ELI) typeInfo); - } else if (typeInfo instanceof ElementInfo) { - return getTypeInfo((EI) typeInfo); - } else if (typeInfo instanceof WildcardTypeInfo) { - return createWildcardTypeInfo((WTI) typeInfo); - } else if (typeInfo instanceof ClassInfo) { - return getTypeInfo((CI) typeInfo); - } else { - throw new UnsupportedOperationException(typeInfo.getClass() - .getName()); - } - } - - private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { - return builtinLeafInfos.get(typeInfo); - } - - private MTypeInfo getTypeInfo(EI info) { - @SuppressWarnings("unchecked") - EPI p = (EPI) info.getProperty(); - @SuppressWarnings("unchecked") - TI contentType = (TI) info.getContentType(); - return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), - p.id(), p.getExpectedMimeType()); - } - - protected MClassInfo getTypeInfo(CI info) { - return classInfos.get(info); - } - - private MEnumLeafInfo getTypeInfo(ELI info) { - return enumLeafInfos.get(info); - - } - - private void populateEnumLeafInfo(ELI info, MEnumLeafInfo enumLeafInfo) { - @SuppressWarnings("rawtypes") - Iterable _constants = info.getConstants(); - @SuppressWarnings("unchecked") - final Iterable> enumConstants = (Iterable>) _constants; - for (EnumConstant enumConstant : enumConstants) { - enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( - enumLeafInfo, (EC) enumConstant)); - } - } - - protected MElementInfo getElementInfo(EI info) { - return elementInfos.get(info); - - } - - protected MClassInfo createClassInfo(CI info) { - return new CMClassInfo(createClassInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), createBaseTypeInfo(info), - info.isElement() ? info.getElementName() : null); - } - - private void populateClassInfo(CI info, MClassInfo classInfo) { - - if (info.hasAttributeWildcard()) { - classInfo.addProperty(createAnyAttributePropertyInfo(classInfo)); - } - - for (PropertyInfo p : (List>) info - .getProperties()) { - classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); - } - } - - protected MClassTypeInfo createBaseTypeInfo(CI info) { - return info.getBaseClass() == null ? null : getTypeInfo((CI) info - .getBaseClass()); - } - - private MPropertyInfo createPropertyInfo( - final MClassInfo classInfo, PI p) { - - if (p instanceof AttributePropertyInfo) { - @SuppressWarnings("unchecked") - final API api = (API) p; - return createAttributePropertyInfo(classInfo, api); - } else if (p instanceof ValuePropertyInfo) { - @SuppressWarnings("unchecked") - final VPI vpi = (VPI) p; - return createValuePropertyInfo(classInfo, vpi); - } else if (p instanceof ElementPropertyInfo) { - @SuppressWarnings("unchecked") - final EPI ep = (EPI) p; - if (ep.getTypes().size() == 1) { - return createElementPropertyInfo(classInfo, ep); - } else { - return createElementsPropertyInfo(classInfo, ep); - - } - } else if (p instanceof ReferencePropertyInfo) { - @SuppressWarnings("unchecked") - final RPI rp = (RPI) p; - final Set> elements = rp.getElements(); - if (elements.size() == 0 - && rp.getWildcard() != null - && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { - return createAnyElementPropertyInfo(classInfo, rp); - } else if (elements.size() == 1) { - return createElementRefPropertyInfo(classInfo, rp); - } else { - return createElementRefsPropertyInfo(classInfo, rp); - } - } else if (p instanceof MapPropertyInfo) { - // System.out.println("Map property: " + p.getName()); - // MapPropertyInfo mp = (MapPropertyInfo) p; - throw new UnsupportedOperationException(); - } else { - throw new AssertionError(); - } - - } - - protected MPropertyInfo createAttributePropertyInfo( - final MClassInfo classInfo, final API propertyInfo) { - return new CMAttributePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo), - propertyInfo.getXmlName()); - } - - protected MPropertyInfo createValuePropertyInfo( - final MClassInfo classInfo, final VPI propertyInfo) { - return new CMValuePropertyInfo( - createPropertyInfoOrigin((PI) propertyInfo), classInfo, - propertyInfo.getName(), getTypeInfo(propertyInfo)); - } - - protected MPropertyInfo createElementPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - final TypeRef typeRef = ep.getTypes().get(0); - return new CMElementPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), - getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); - } - - protected MPropertyInfo createElementsPropertyInfo( - final MClassInfo classInfo, final EPI ep) { - List> types = ep.getTypes(); - final Collection> typedElements = new ArrayList>( - types.size()); - for (TypeRef typeRef : types) { - typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), - getTypeInfo(ep, typeRef))); - } - return new CMElementsPropertyInfo( - createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), - ep.isCollection() && !ep.isValueList(), typedElements, - ep.getXmlName()); - } - - protected MPropertyInfo createAnyElementPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - return new CMAnyElementPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, - rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final Element element = rp.getElements().iterator().next(); - return new CMElementRefPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), getTypeInfo(rp, element), - element.getElementName(), rp.getXmlName(), - - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected MPropertyInfo createElementRefsPropertyInfo( - final MClassInfo classInfo, final RPI rp) { - final List> typedElements = new ArrayList>(); - for (Element element : rp.getElements()) { - typedElements.add(new CMElementTypeInfo(element - .getElementName(), getTypeInfo(rp, element))); - } - return new CMElementRefsPropertyInfo( - createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), - rp.isCollection(), typedElements, rp.getXmlName(), - rp.isMixed(), rp.getWildcard() == null ? false - : rp.getWildcard().allowDom, - rp.getWildcard() == null ? false - : rp.getWildcard().allowTypedObject); - } - - protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( - final MClassInfo classInfo) { - return new CMAnyAttributePropertyInfo( - createAnyAttributePropertyInfoOrigin(), classInfo, - "otherAttributes"); - } - - protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { - return getTypeInfo(vp, (TI) vp.ref().iterator().next(), - vp.isCollection(), vp.getAdapter(), vp.id(), - vp.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { - return getTypeInfo(ap, (TI) ap.ref().iterator().next(), - ap.isCollection(), ap.getAdapter(), ap.id(), - ap.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, - final TypeRef typeRef) { - return getTypeInfo(ep, (TI) typeRef.getTarget(), - - ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); - } - - protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, - Element element) { - return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), - rp.getExpectedMimeType()); - } - - protected abstract MPackageInfo getPackage(CI info); - - protected abstract String getLocalName(CI info); - - protected abstract MClassInfo getScope(CI info); - - protected abstract MPackageInfo getPackage(ELI info); - - protected abstract String getLocalName(ELI info); - - protected abstract String getLocalName(EI info); - - protected abstract MPackageInfo getPackage(EI info); - - protected abstract MContainer getContainer(CI info); - - protected abstract MContainer getContainer(EI info); - - protected abstract MContainer getContainer(ELI info); - - // - - protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { - return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), - info.getType(), info.getTypeName()); - } - - protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { - @SuppressWarnings("unchecked") - final TI baseType = (TI) info.getBaseType(); - return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), - info.getClazz(), getPackage(info), getContainer(info), - getLocalName(info), getTypeInfo(baseType), - info.getElementName()); - } - - protected CMEnumConstantInfo createEnumContantInfo( - MEnumLeafInfo enumLeafInfo, EC enumConstant) { - return new CMEnumConstantInfo( - createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, - enumConstant.getLexicalValue()); - } - - protected MElementInfo createElementInfo(EI element) { - @SuppressWarnings("unchecked") - final CI scopeCI = (CI) element.getScope(); - final MClassInfo scope = element.getScope() == null ? null - : getTypeInfo(scopeCI); - final QName substitutionHead = element.getSubstitutionHead() == null ? null - : element.getSubstitutionHead().getElementName(); - final MElementInfo elementInfo = new CMElementInfo( - createElementInfoOrigin(element), getPackage(element), - getContainer(element), getLocalName(element), - element.getElementName(), scope, getTypeInfo(element), - substitutionHead); - return elementInfo; - } - - protected MTypeInfo createWildcardTypeInfo(WTI info) { - return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), - info.getType()); - } - - protected MModelInfoOrigin createModelInfoOrigin(TIS info) { - return new CMModelInfoOrigin(info); - } - - protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { - return new CMBuiltinLeafInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CI info) { - return new CMClassInfoOrigin(info); - } - - protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { - return new CMAnyAttributePropertyInfoOrigin(); - } - - protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { - return new CMPropertyInfoOrigin(info); - } - - protected MElementInfoOrigin createElementInfoOrigin(EI info) { - return new CMElementInfoOrigin(info); - } - - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { - return new CMEnumLeafInfoOrigin(info); - } - - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { - return new CMEnumConstantInfoOrigin(info); - } - - protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { - return new CMWildcardTypeInfoOrigin(info); - } - - protected abstract T createListType(T elementType); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java deleted file mode 100644 index 1e50748c..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.text.MessageFormat; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; - -public class CMList implements MList { - - private final MTypeInfo itemTypeInfo; - private final T targetType; - private final MCustomizations customizations = new CMCustomizations(); - - public CMList(T targetType, MTypeInfo itemTypeInfo) { - Validate.notNull(targetType); - Validate.notNull(itemTypeInfo); - this.targetType = targetType; - this.itemTypeInfo = itemTypeInfo; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MTypeInfo getItemTypeInfo() { - return itemTypeInfo; - } - - @Override - public String toString() { - return MessageFormat.format("List [{0}]", getItemTypeInfo()); - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitList(this); - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java deleted file mode 100644 index e3ee1ebd..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; -import com.sun.xml.bind.v2.model.core.ElementInfo; -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModel implements MModelInfo { - - private final MModelInfoOrigin origin; - - private final CMCustomizations customizations = new CMCustomizations(); - - private final Collection> builtinLeafInfos = new ArrayList>(); - private final Collection> unmodifiableBuiltinLeafInfos = Collections - .unmodifiableCollection(builtinLeafInfos); - private final Map> builtinLeafInfosMap = new HashMap>(); - private final Map> unmodifiableBuiltinLeafInfosMap = Collections - .unmodifiableMap(builtinLeafInfosMap); - - private final Collection> classInfos = new ArrayList>(); - private final Collection> unmodifiableClassInfos = Collections - .unmodifiableCollection(classInfos); - - private final Collection> enumLeafInfos = new ArrayList>(); - private final Collection> unmodifiableEnumLeafInfos = Collections - .unmodifiableCollection(enumLeafInfos); - - private final Collection> typeInfos = new ArrayList>(); - private final Collection> unmodifiableTypeInfos = Collections - .unmodifiableCollection(typeInfos); - - private final Collection> elementInfos = new ArrayList>(); - private final Collection> unmodifiableElementInfos = Collections - .unmodifiableCollection(elementInfos); - - private final Map> elementInfosMap = new HashMap>(); - private final Map> unmodifiableElementInfosMap = Collections - .unmodifiableMap(elementInfosMap); - - public CMModel(MModelInfoOrigin origin) { - Validate.notNull(origin); - this.origin = origin; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MModelInfoOrigin getOrigin() { - return origin; - } - - public Collection> getBuiltinLeafInfos() { - return unmodifiableBuiltinLeafInfos; - } - - public Collection> getClassInfos() { - return unmodifiableClassInfos; - } - - public Collection> getEnumLeafInfos() { - return unmodifiableEnumLeafInfos; - } - - public Collection> getElementInfos() { - return unmodifiableElementInfos; - } - - public Map> getElementInfosMap() { - return unmodifiableElementInfosMap; - } - - public Collection> getTypeInfos() { - return unmodifiableTypeInfos; - } - - public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { - Validate.notNull(name); - return this.unmodifiableBuiltinLeafInfosMap.get(name); - } - - public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { - Validate.notNull(builtinLeafInfo); - this.builtinLeafInfos.add(builtinLeafInfo); - this.typeInfos.add(builtinLeafInfo); - this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), - builtinLeafInfo); - } - - public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.add(enumLeafInfo); - this.typeInfos.add(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = enumLeafInfo - .createElementInfo(null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - - } - - public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { - Validate.notNull(enumLeafInfo); - this.enumLeafInfos.remove(enumLeafInfo); - this.typeInfos.remove(enumLeafInfo); - final QName elementName = enumLeafInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { - - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo - .getOrigin()).getSource(); - tis.enums().remove(eli.getClazz()); - } - } - - public void addClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.add(classInfo); - this.typeInfos.add(classInfo); - - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = classInfo.createElementInfo( - null, null); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementName, elementInfo); - } - } - - public void removeClassInfo(MClassInfo classInfo) { - Validate.notNull(classInfo); - this.classInfos.remove(classInfo); - this.typeInfos.remove(classInfo); - final QName elementName = classInfo.getElementName(); - if (elementName != null) { - final MElementInfo elementInfo = this.elementInfosMap - .remove(elementName); - if (elementInfo != null) { - this.elementInfos.remove(elementInfo); - } - } - if (getOrigin() instanceof TypeInfoSetOrigin - && classInfo.getOrigin() instanceof ClassInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - final ClassInfo ci = ((ClassInfoOrigin>) classInfo - .getOrigin()).getSource(); - tis.beans().remove(ci); - - } - } - - public void addElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.add(elementInfo); - this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); - - } - - public void removeElementInfo(MElementInfo elementInfo) { - Validate.notNull(elementInfo); - Validate.notNull(elementInfo.getElementName()); - this.elementInfos.remove(elementInfo); - this.elementInfosMap.remove(elementInfo.getElementName()); - // TODO Not very good - if (getOrigin() instanceof TypeInfoSetOrigin - && elementInfo.getOrigin() instanceof ElementInfoOrigin) { - final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) - .getSource(); - - final ElementInfo ei = ((ElementInfoOrigin>) elementInfo - .getOrigin()).getSource(); - - tis.getElementMappings(ei.getScope().getClazz()).remove( - ei.getElementName()); - } - - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java deleted file mode 100644 index 85cc5a38..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfo implements MPackageInfo { - - private final MPackageInfoOrigin origin; - private final String packageName; - - public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { - Validate.notNull(origin); - Validate.notNull(packageName); - this.origin = origin; - this.packageName = packageName; - } - - public MPackageInfoOrigin getOrigin() { - return origin; - } - - public String getPackageName() { - return packageName; - } - - public String getPackagedName(String localName) { - if (StringUtils.isEmpty(packageName)) { - return localName; - } else { - return packageName + "." + localName; - } - } - - public String getLocalName() { - return null; - } - - public String getContainerLocalName(String delimiter) { - return null; - } - - public MPackageInfo getPackageInfo() { - return this; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java deleted file mode 100644 index 196a11bd..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMPropertyInfo implements MPropertyInfo, - MCustomizable { - - private CMCustomizations customizations = new CMCustomizations(); - private MPropertyInfoOrigin origin; - private MClassInfo classInfo; - - private final String privateName; - - private final boolean collection; - - public CMPropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection) { - Validate.notNull(origin); - Validate.notNull(classInfo); - Validate.notNull(privateName); - this.origin = origin; - this.classInfo = classInfo; - this.privateName = privateName; - this.collection = collection; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public MPropertyInfoOrigin getOrigin() { - return origin; - } - - public MClassInfo getClassInfo() { - return classInfo; - } - - public String getPrivateName() { - return privateName; - } - - public String getPublicName() { - // TODO - return this.getPrivateName(); - } - - public boolean isCollection() { - return collection; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java deleted file mode 100644 index 7f7369d6..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public abstract class CMSingleTypePropertyInfo extends - CMPropertyInfo implements MSingleTypePropertyInfo { - - private final MTypeInfo typeInfo; - - public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, boolean collection, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, collection); - Validate.notNull(typeInfo); - this.typeInfo = typeInfo; - } - - public MTypeInfo getTypeInfo() { - return typeInfo; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java deleted file mode 100644 index 4818dfa7..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMValuePropertyInfo extends CMSingleTypePropertyInfo - implements MValuePropertyInfo { - - public CMValuePropertyInfo(MPropertyInfoOrigin origin, - MClassInfo classInfo, String privateName, - MTypeInfo typeInfo) { - super(origin, classInfo, privateName, false, typeInfo); - } - - public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { - return visitor.visitValuePropertyInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java deleted file mode 100644 index 5f9236b9..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -public class CMWildcardTypeInfo implements MWildcardTypeInfo { - - private final T targetType; - private final MWildcardTypeInfoOrigin origin; - private final MCustomizations customizations = new CMCustomizations(); - - public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { - Validate.notNull(origin); - this.origin = origin; - this.targetType = targetType; - } - - public MCustomizations getCustomizations() { - return customizations; - } - - public T getTargetType() { - return targetType; - } - - public MWildcardTypeInfoOrigin getOrigin() { - return origin; - } - - public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { - return visitor.visitWildcardTypeInfo(this); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java deleted file mode 100644 index 6bcfa8c6..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public interface BuiltinLeafInfoOrigin> extends MSourced{ - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java deleted file mode 100644 index 75528e67..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java deleted file mode 100644 index 687e4fff..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; - -public class CMBuiltinLeafInfoOrigin> - implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { - - private final BLI source; - - public CMBuiltinLeafInfoOrigin(BLI source) { - Validate.notNull(source); - this.source = source; - } - - public BLI getSource() { - return source; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java deleted file mode 100644 index 506e4326..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassElementInfoOrigin> - implements MElementInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassElementInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java deleted file mode 100644 index e35226d8..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public class CMClassInfoOrigin> implements - MClassInfoOrigin, ClassInfoOrigin { - - private final CI source; - - public CMClassInfoOrigin(CI source) { - Validate.notNull(source); - this.source = source; - } - - public CI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMClassElementInfoOrigin(getSource()); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java deleted file mode 100644 index e11980d6..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public class CMElementInfoOrigin> implements - MElementInfoOrigin, ElementInfoOrigin { - - private final EI source; - - public CMElementInfoOrigin(EI source) { - Validate.notNull(source); - this.source = source; - } - - public EI getSource() { - return source; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java deleted file mode 100644 index ae19b6db..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public class CMEnumConstantInfoOrigin> - implements MEnumConstantInfoOrigin, EnumConstantOrigin { - - private final ECI source; - - public CMEnumConstantInfoOrigin(ECI source) { - Validate.notNull(source); - this.source = source; - } - - public ECI getSource() { - return source; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java deleted file mode 100644 index 788c688e..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumElementInfoOrigin> - implements MElementInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumElementInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java deleted file mode 100644 index aa2c1f51..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public class CMEnumLeafInfoOrigin> - implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { - - private final ELI source; - - public CMEnumLeafInfoOrigin(ELI source) { - Validate.notNull(source); - this.source = source; - } - - public ELI getSource() { - return source; - } - - public MElementInfoOrigin createElementInfoOrigin() { - return new CMEnumElementInfoOrigin( - getSource()); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java deleted file mode 100644 index b10b0ec5..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public class CMModelInfoOrigin> - implements MModelInfoOrigin, TypeInfoSetOrigin { - - private final TIS source; - - public CMModelInfoOrigin(TIS source) { - Validate.notNull(source); - this.source = source; - } - - public TIS getSource() { - return source; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java deleted file mode 100644 index ad517868..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; - -public class CMPackageInfoOrigin implements MPackageInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java deleted file mode 100644 index e86644a0..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, - PropertyInfoOrigin { - - private final PI source; - - public CMPropertyInfoOrigin(PI source) { - Validate.notNull(source); - this.source = source; - } - - public PI getSource() { - return source; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java deleted file mode 100644 index 07624e02..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public class CMWildcardTypeInfoOrigin> - implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { - - private final WTI source; - - public CMWildcardTypeInfoOrigin(WTI source) { - Validate.notNull(source); - this.source = source; - } - - public WTI getSource() { - return source; - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java deleted file mode 100644 index 5eba348e..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ClassInfo; - -public interface ClassInfoOrigin> extends - MSourced { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java deleted file mode 100644 index 2eba08e0..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.ElementInfo; - -public interface ElementInfoOrigin> extends - MSourced { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java deleted file mode 100644 index f562434d..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumConstant; - -public interface EnumConstantOrigin> - extends MSourced { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java deleted file mode 100644 index d1aeeb5b..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.EnumLeafInfo; - -public interface EnumLeafInfoOrigin> extends - MSourced { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java deleted file mode 100644 index 1ea27730..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.PropertyInfo; - -public interface PropertyInfoOrigin> - extends MSourced { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java deleted file mode 100644 index fdccb041..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.TypeInfoSet; - -public interface TypeInfoSetOrigin> - extends MSourced { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java deleted file mode 100644 index a63844f6..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; - -public interface WildcardTypeInfoOrigin> - extends MSourced { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java deleted file mode 100644 index ab8b004f..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MBuiltinLeafInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java deleted file mode 100644 index 7b80e507..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MClassInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java deleted file mode 100644 index f1c6d81b..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MElementInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java deleted file mode 100644 index 3d20d1cf..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumConstantInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java deleted file mode 100644 index df384345..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MEnumLeafInfoOrigin { - - public MElementInfoOrigin createElementInfoOrigin(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java deleted file mode 100644 index 6b4271b5..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MModelInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java deleted file mode 100644 index bb87ab98..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MOriginated { - - public O getOrigin(); - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java deleted file mode 100644 index 368c1293..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPackageInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java deleted file mode 100644 index 51105494..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MPropertyInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java deleted file mode 100644 index a1647c32..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.origin; - -public interface MWildcardTypeInfoOrigin { - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java deleted file mode 100644 index c04581aa..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class DefaultPropertyInfoVisitor implements - MPropertyInfoVisitor { - - public V visitPropertyInfo(MPropertyInfo info) { - return null; - } - - public V visitElementPropertyInfo(MElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementsPropertyInfo(MElementsPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAttributePropertyInfo(MAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitValuePropertyInfo(MValuePropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - return visitPropertyInfo(info); - } - - public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - return visitPropertyInfo(info); - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java deleted file mode 100644 index c92e2e84..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MID; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; -import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; -import org.jvnet.jaxb2_commons.xml.bind.model.MList; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; - -public class DefaultTypeInfoVisitor implements - MTypeInfoVisitor { - - public V visitTypeInfo(MTypeInfo typeInfo) { - return null; - } - - public V visitList(MList info) { - return visitTypeInfo(info); - } - - public V visitID(MID info) { - return visitTypeInfo(info); - } - - public V visitIDREF(MIDREF info) { - return visitTypeInfo(info); - } - - public V visitIDREFS(MIDREFS info) { - return visitTypeInfo(info); - } - - public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitEnumLeafInfo(MEnumLeafInfo info) { - return visitTypeInfo(info); - } - - public V visitWildcardTypeInfo(MWildcardTypeInfo info) { - return visitTypeInfo(info); - } - - public V visitClassInfo(MClassInfo info) { - return visitTypeInfo(info); - } - - public V visitClassRef(MClassRef info) { - return visitTypeInfo(info); - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java deleted file mode 100644 index 43c96d12..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.StringUtils; -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -public class PackageInfoQNameAnalyzer { - - private final MModelInfo modelInfo; - - public PackageInfoQNameAnalyzer(MModelInfo modelInfo) { - Validate.notNull(modelInfo); - this.modelInfo = modelInfo; - } - - public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - counter.add(name.getNamespaceURI()); - } - - public void attribute(QName name) { - - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { - final NamespaceURICounter counter = new NamespaceURICounter(); - final QNameCollector collector = new QNameCollector() { - - public void element(QName name) { - } - - public void attribute(QName name) { - counter.add(name.getNamespaceURI()); - } - }; - - collectNamespaceURIs(packageInfo, collector); - return counter.getMostUsedNamespaceURI(); - } - - private void collectNamespaceURIs(MPackageInfo packageInfo, - final QNameCollector collector) { - for (MElementInfo elementInfo : modelInfo.getElementInfos()) { - if (elementInfo.getPackageInfo() == packageInfo) { - collector.element(elementInfo.getElementName()); - } - } - - final QNameCollectingPropertyInfoVisitor visitor = new QNameCollectingPropertyInfoVisitor( - collector); - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - if (classInfo.getPackageInfo() == packageInfo) { - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - propertyInfo.acceptPropertyInfoVisitor(visitor); - } - } - } - } - - private static class NamespaceURICounter { - private Map map = new HashMap(); - - public void add(String namespaceURI) { - final Integer count = map.get(namespaceURI); - if (count == null) { - map.put(namespaceURI, Integer.valueOf(1)); - } else { - map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); - } - } - - public String getMostUsedNamespaceURI() { - String namespaceURI = null; - int count = 0; - - for (Map.Entry e : map.entrySet()) { - final String currentNamespaceURI = e.getKey(); - final int currentCount = e.getValue(); - if (namespaceURI == null) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } else { - if (currentCount > count - || (currentCount == count && namespaceURI == null)) { - namespaceURI = currentNamespaceURI; - count = currentCount; - } - } - } - - return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; - - } - - } - -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java deleted file mode 100644 index 6729008e..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -public class QNameCollectingPropertyInfoVisitor implements - MPropertyInfoVisitor { - - private final QNameCollector collector; - - public QNameCollectingPropertyInfoVisitor(QNameCollector collector) { - Validate.notNull(collector); - this.collector = collector; - } - - public Void visitElementPropertyInfo(MElementPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementsPropertyInfo(MElementsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } - - public Void visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { - return null; - } - - public Void visitAttributePropertyInfo(MAttributePropertyInfo info) { - collector.attribute(info.getAttributeName()); - return null; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - return null; - } - - public Void visitElementRefPropertyInfo(MElementRefPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - QName elementName = info.getElementName(); - collector.element(elementName); - return null; - } - - public Void visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { - QName wrapperElementName = info.getWrapperElementName(); - if (wrapperElementName != null) { - collector.element(wrapperElementName); - } - for (MElementTypeInfo elementTypeInfo : info - .getElementTypeInfos()) { - QName elementName = elementTypeInfo.getElementName(); - collector.element(elementName); - } - return null; - } -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java deleted file mode 100644 index 2bd50907..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.xml.bind.model.util; - -import javax.xml.namespace.QName; - -public interface QNameCollector { - - public void element(QName name); - - public void attribute(QName name); -} diff --git a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java deleted file mode 100644 index 5119acde..00000000 --- a/basics/trunk/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.jvnet.jaxb2_commons.xmlschema; - -import javax.xml.namespace.QName; - -public class XmlSchemaConstants { - public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; - public static final QName ANYTYPE = xsd("anyType"); - public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); - - public static final QName STRING = xsd("string"); - - public static final QName NORMALIZEDSTRING = xsd("normalizedString"); - - public static final QName TOKEN = xsd("token"); - - public static final QName LANGUAGE = xsd("language"); - - public static final QName NAME = xsd("Name"); - - public static final QName NCNAME = xsd("NCName"); - - public static final QName ID = xsd("ID"); - - public static final QName IDREF = xsd("IDREF"); - - public static final QName IDREFS = xsd("IDREFS"); - - public static final QName ENTITY = xsd("ENTITY"); - - public static final QName ENTITIES = xsd("ENTITIES"); - - public static final QName NMTOKEN = xsd("NMTOKEN"); - - public static final QName NMTOKENS = xsd("NMTOKENS"); - - public static final QName BOOLEAN = xsd("boolean"); - - public static final QName BASE64BINARY = xsd("base64Binary"); - - public static final QName HEXBINARY = xsd("hexBinary"); - - public static final QName FLOAT = xsd("float"); - - public static final QName DECIMAL = xsd("decimal"); - - public static final QName INTEGER = xsd("integer"); - - public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); - - public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); - - public static final QName LONG = xsd("long"); - - public static final QName INT = xsd("int"); - - public static final QName SHORT = xsd("short"); - - public static final QName BYTE = xsd("byte"); - - public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); - - public static final QName UNSIGNEDLONG = xsd("unsignedLong"); - - public static final QName UNSIGNEDINT = xsd("unsignedInt"); - - public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); - - public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); - - public static final QName POSITIVEINTEGER = xsd("positiveInteger"); - - public static final QName DOUBLE = xsd("double"); - - public static final QName ANYURI = xsd("anyURI"); - - public static final QName QNAME = xsd("QName"); - - public static final QName NOTATION = xsd("NOTATION"); - - public static final QName DURATION = xsd("duration"); - - public static final QName DATETIME = xsd("dateTime"); - public static final QName TIME = xsd("time"); - public static final QName DATE = xsd("date"); - public static final QName GYEARMONTH = xsd("gYearMonth"); - public static final QName GYEAR = xsd("gYear"); - public static final QName GMONTHDAY = xsd("gMonthDay"); - public static final QName GDAY = xsd("gDay"); - public static final QName GMONTH = xsd("gMonth"); - - public static final QName CALENDAR = xsd("\u0000"); - - public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, - ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, - NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, - BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, - NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, - NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, - UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, - DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, - GMONTH, CALENDAR }; - - public static QName xsd(String localPart) { - return new QName(NAMESPACE_URI, localPart, "xsd"); - } - -} diff --git a/basics/trunk/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/basics/trunk/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties deleted file mode 100644 index a5249335..00000000 --- a/basics/trunk/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties +++ /dev/null @@ -1,10 +0,0 @@ -org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ -Object: {0}. - -org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ -Property name: {1}.\n\ -Property value: {0}. - -org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ -Item index: {1}.\n\ -Item value: {0}. \ No newline at end of file diff --git a/basics/trunk/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/basics/trunk/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java deleted file mode 100644 index 1c3744b0..00000000 --- a/basics/trunk/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlRootElement; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Polygon; - -public class CopyStrategyTest extends TestCase { - - public void testPolygon() { - final GeometryFactory geometryFactory = new GeometryFactory(); - final Polygon polygon = geometryFactory.createPolygon( - geometryFactory.createLinearRing(new Coordinate[] { - new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), - - new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), - new Coordinate(0, 0, 0) }), null); - - polygon.clone(); - - new JAXBCopyStrategy().copy(null, polygon); - - } - - public void testAny() throws Exception { - JAXBContext context = JAXBContext.newInstance(A.class); - - final InputStream is = getClass().getResourceAsStream("Test[0].xml"); - try { - A a = (A) context.createUnmarshaller().unmarshal(is); - - a.copyTo(a.createNewInstance()); - } finally { - IOUtils.closeQuietly(is); - } - } - - @XmlRootElement(name = "a") - @XmlAccessorType(XmlAccessType.FIELD) - public static class A implements CopyTo { - @XmlAnyElement(lax = true) - private Object any; - - public Object getAny() { - return any; - } - - public void setAny(Object any) { - this.any = any; - } - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A copy = ((target == null) ? ((A) createNewInstance()) - : ((A) target)); - { - Object sourceAny; - sourceAny = this.getAny(); - Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); - copy.setAny(copyAny); - } - return copy; - } - - } -} diff --git a/basics/trunk/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/basics/trunk/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java deleted file mode 100644 index db448155..00000000 --- a/basics/trunk/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.lang.tests; - -import java.util.IdentityHashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.CopyTo; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; - -public class CyclicTests extends TestCase { - - public interface CopyToInstance extends CopyTo { - } - - public static class A implements CopyToInstance { - public B b; - - public Object createNewInstance() { - return new A(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final A that = (A) target; - that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", - this.b), this.b); - return that; - } - - } - - public static class B implements CopyToInstance { - public A a; - - public Object createNewInstance() { - return new B(); - } - - public Object copyTo(Object target) { - return copyTo(null, target, JAXBCopyStrategy.INSTANCE); - } - - public Object copyTo(ObjectLocator locator, Object target, - CopyStrategy copyStrategy) { - final B that = (B) target; - that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", - this.a), this.a); - return that; - } - } - - public void testCycle() throws Exception { - final A a = new A(); - final B b = new B(); - a.b = b; - b.a = a; - - final A a1 = (A) new JAXBCopyStrategy() { - private Map copies = new IdentityHashMap(); - - @Override - public Object copy(ObjectLocator locator, Object object) { - final Object existingCopy = copies.get(object); - if (existingCopy != null) { - return existingCopy; - } else { - if (object instanceof CopyToInstance) { - final CopyToInstance source = (CopyToInstance) object; - final Object newCopy = source.createNewInstance(); - copies.put(object, newCopy); - source.copyTo(locator, newCopy, this); - return newCopy; - } else { - final Object newCopy = super.copy(locator, object); - copies.put(object, newCopy); - return newCopy; - } - } - } - }.copy(new DefaultRootObjectLocator(a), a); - - assertSame(a1.b.a, a1); - } - -} diff --git a/basics/trunk/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/basics/trunk/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml deleted file mode 100644 index cd73e56a..00000000 --- a/basics/trunk/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/basics/trunk/samples/basic/project-build.xml b/basics/trunk/samples/basic/project-build.xml deleted file mode 100644 index 05001052..00000000 --- a/basics/trunk/samples/basic/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/basic/project-pom.xml b/basics/trunk/samples/basic/project-pom.xml deleted file mode 100644 index 2909b2d1..00000000 --- a/basics/trunk/samples/basic/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-basic-maven - ${project.version} - jar - JAXB2 Basics - Sample [basic-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xinheritance - -Xcopyable - -XenumValue - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/basic/src/main/assembly/src.xml b/basics/trunk/samples/basic/src/main/assembly/src.xml deleted file mode 100644 index 0aa4cf66..00000000 --- a/basics/trunk/samples/basic/src/main/assembly/src.xml +++ /dev/null @@ -1,19 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - *.xml - - - - src - - - diff --git a/basics/trunk/samples/basic/src/main/java/.placeholder b/basics/trunk/samples/basic/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/trunk/samples/basic/src/main/resources/schema.xsd b/basics/trunk/samples/basic/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/trunk/samples/basic/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/trunk/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/trunk/samples/basic/src/test/resources/log4j.properties b/basics/trunk/samples/basic/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/trunk/samples/basic/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/trunk/samples/basic/src/test/samples/1.xml b/basics/trunk/samples/basic/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/trunk/samples/basic/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/trunk/samples/modular-ant/pom.xml b/basics/trunk/samples/modular-ant/pom.xml deleted file mode 100644 index 6cc2d576..00000000 --- a/basics/trunk/samples/modular-ant/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-modular-ant - pom - JAXB2 Basics - Sample [modular-ant] - - org.jvnet.jaxb2_commons - jaxb2-basics-samples - 0.6.4-SNAPSHOT - - - - junit - junit - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - - - org.jvnet.jaxb2_commons - jaxb2-basics-ant - - - org.jvnet.jaxb2_commons - jaxb2-basics-jaxb-xjc - - - com.sun.xml.bind - jaxb-impl - - - - install - - - maven-assembly-plugin - - - ant-assembly - package - - - - - maven-antrun-plugin - - - ant-unpack - pre-integration-test - - - ant-integration-test - integration-test - - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/modular-ant/project-build.xml b/basics/trunk/samples/modular-ant/project-build.xml deleted file mode 100644 index a2fc3e3a..00000000 --- a/basics/trunk/samples/modular-ant/project-build.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/modular-ant/src/main/assembly/src.xml b/basics/trunk/samples/modular-ant/src/main/assembly/src.xml deleted file mode 100644 index b4111a2b..00000000 --- a/basics/trunk/samples/modular-ant/src/main/assembly/src.xml +++ /dev/null @@ -1,24 +0,0 @@ - - src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - diff --git a/basics/trunk/samples/modular-ant/src/main/java/.placeholder b/basics/trunk/samples/modular-ant/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/trunk/samples/modular-ant/src/main/resources/schema.xsd b/basics/trunk/samples/modular-ant/src/main/resources/schema.xsd deleted file mode 100644 index 431bccbf..00000000 --- a/basics/trunk/samples/modular-ant/src/main/resources/schema.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index 11f3612f..00000000 --- a/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index cf860a85..00000000 --- a/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index b04ae32d..00000000 --- a/basics/trunk/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/trunk/samples/modular-ant/src/test/resources/log4j.properties b/basics/trunk/samples/modular-ant/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/trunk/samples/modular-ant/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/trunk/samples/modular-ant/src/test/samples/1.xml b/basics/trunk/samples/modular-ant/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/trunk/samples/modular-ant/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/trunk/samples/po/project-build.xml b/basics/trunk/samples/po/project-build.xml deleted file mode 100644 index 4523094a..00000000 --- a/basics/trunk/samples/po/project-build.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/po/project-pom.xml b/basics/trunk/samples/po/project-pom.xml deleted file mode 100644 index edf3ced9..00000000 --- a/basics/trunk/samples/po/project-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - org.jvnet.jaxb2_commons - jaxb2-basics-sample-po-maven - ${project.version} - jar - JAXB2 Basics - Sample [po-maven] - - - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${project.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-testing - ${project.version} - test - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} - - - - generate - - - - - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - -Xinheritance - - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${project.version} - - - - - - true - maven-compiler-plugin - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/po/src/main/java/.placeholder b/basics/trunk/samples/po/src/main/java/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/basics/trunk/samples/po/src/main/resources/bindings.xjb b/basics/trunk/samples/po/src/main/resources/bindings.xjb deleted file mode 100644 index 8d576417..00000000 --- a/basics/trunk/samples/po/src/main/resources/bindings.xjb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/basics/trunk/samples/po/src/main/resources/purchaseorder.xsd b/basics/trunk/samples/po/src/main/resources/purchaseorder.xsd deleted file mode 100644 index 18b9fe11..00000000 --- a/basics/trunk/samples/po/src/main/resources/purchaseorder.xsd +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Purchase order schema for Example.com. - Copyright 2000 Example.com. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java deleted file mode 100644 index e104c26f..00000000 --- a/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); - Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); - } - -} diff --git a/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java deleted file mode 100644 index 14be239a..00000000 --- a/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java deleted file mode 100644 index c4a3d61b..00000000 --- a/basics/trunk/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.po; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/trunk/samples/po/src/test/resources/log4j.properties b/basics/trunk/samples/po/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/trunk/samples/po/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/trunk/samples/po/src/test/samples/po.xml b/basics/trunk/samples/po/src/test/samples/po.xml deleted file mode 100644 index 09546435..00000000 --- a/basics/trunk/samples/po/src/test/samples/po.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Alice Smith - 123 Maple Street - Mill Valley - CA - 90952 - - - Robert Smith - 8 Oak Avenue - Old Town - PA - 95819 - - Hurry, my lawn is going wild! - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 1 - 39.98 - 1999-05-21 - - - \ No newline at end of file diff --git a/basics/trunk/samples/src/main/assembly/ant-src.xml b/basics/trunk/samples/src/main/assembly/ant-src.xml deleted file mode 100644 index c5240703..00000000 --- a/basics/trunk/samples/src/main/assembly/ant-src.xml +++ /dev/null @@ -1,30 +0,0 @@ - - ant-src - - zip - - - - - README* - LICENSE* - NOTICE* - build.xml - - - - src - - - - - lib - - - - - ${basedir}/project-build.xml - build.xml - - - diff --git a/basics/trunk/samples/src/main/assembly/maven-src.xml b/basics/trunk/samples/src/main/assembly/maven-src.xml deleted file mode 100644 index 2b8121ec..00000000 --- a/basics/trunk/samples/src/main/assembly/maven-src.xml +++ /dev/null @@ -1,31 +0,0 @@ - - maven-src - - zip - - - - - README* - LICENSE* - NOTICE* - - - - src - - - a - - - b - - - - - ${basedir}/project-pom.xml - pom.xml - true - - - diff --git a/basics/trunk/testing/.classpath b/basics/trunk/testing/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/trunk/testing/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/trunk/testing/.project b/basics/trunk/testing/.project deleted file mode 100644 index 4ead1953..00000000 --- a/basics/trunk/testing/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-testing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/trunk/testing/.settings/org.eclipse.core.resources.prefs b/basics/trunk/testing/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4c28b1a8..00000000 --- a/basics/trunk/testing/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/basics/trunk/testing/.settings/org.eclipse.jdt.core.prefs b/basics/trunk/testing/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/trunk/testing/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/trunk/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/basics/trunk/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java deleted file mode 100644 index 6241c207..00000000 --- a/basics/trunk/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.lang; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.dom.DOMSource; - -import org.custommonkey.xmlunit.Diff; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; -import org.w3c.dom.Node; - -public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { - - @Override - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - - if (lhs instanceof Node && rhs instanceof Node) { - return equalsInternal(leftLocator, rightLocator, (Node) lhs, - (Node) rhs); - } else if (lhs instanceof XMLGregorianCalendar - && rhs instanceof XMLGregorianCalendar) { - return equalsInternal(leftLocator, rightLocator, - (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); - - } else { - return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); - } - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, XMLGregorianCalendar left, - XMLGregorianCalendar right) { - return equals(leftLocator, rightLocator, left.normalize() - .toGregorianCalendar().getTimeInMillis(), right.normalize() - .toGregorianCalendar().getTimeInMillis()); - } - - protected boolean equalsInternal(ObjectLocator leftLocator, - ObjectLocator rightLocator, Node lhs, Node rhs) { - final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( - (Node) rhs)); - return diff.identical(); - } - -} diff --git a/basics/trunk/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/basics/trunk/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java deleted file mode 100644 index ae950cc5..00000000 --- a/basics/trunk/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jvnet.jaxb2_commons.test; - -import java.io.File; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public abstract class AbstractSamplesTest extends TestCase { - - protected Log logger = LogFactory.getLog(getTestClass()); - - protected String getContextPath() { - return getTestClass().getPackage().getName(); - } - - protected abstract void checkSample(File sample) throws Exception; - - public void testSamples() throws Exception { - logger.debug("Testing samples."); - int failed = 0; - final File[] sampleFiles = getSampleFiles(); - for (final File sampleFile : sampleFiles) { - logger.debug("Testing sample [" + sampleFile.getName() + "]."); - try { - checkSample(sampleFile); - } catch (Throwable ex) { - logger.error("Sample [" + sampleFile.getName() - + "] failed the check.", ex); - failed++; - } - logger.debug("Finished testing sample [" + sampleFile.getName() - + "]."); - } - logger.debug("Finished testing samples."); - - Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length - + "] failed the check.", failed == 0); - } - - protected File getBaseDir() { - try { - return (new File(getTestClass().getProtectionDomain() - .getCodeSource().getLocation().getFile())).getParentFile() - .getParentFile().getAbsoluteFile(); - } catch (Exception ex) { - throw new AssertionError(ex); - } - } - - protected Class getTestClass() { - return getClass(); - } - - protected File getSamplesDirectory() { - return new File(getBaseDir(), getSamplesDirectoryName()); - } - - public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; - - protected String getSamplesDirectoryName() { - return DEFAULT_SAMPLES_DIRECTORY_NAME; - } - - @SuppressWarnings("unchecked") - protected File[] getSampleFiles() { - File samplesDirectory = getSamplesDirectory(); - logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() - + "]."); - final Collection files = FileUtils.listFiles(samplesDirectory, - new String[] { "xml" }, true); - return files.toArray(new File[files.size()]); - } - - protected ClassLoader getContextClassLoader() { - return getTestClass().getClassLoader(); - } - - protected Map getContextProperties() { - return null; - } - - public JAXBContext createContext() throws JAXBException { - final String contextPath = getContextPath(); - final ClassLoader classLoader = getContextClassLoader(); - final Map properties = getContextProperties(); - if (classLoader == null) { - return JAXBContext.newInstance(contextPath); - } else { - if (properties == null) { - return JAXBContext.newInstance(contextPath, classLoader); - } else { - return JAXBContext.newInstance(contextPath, classLoader, - properties); - } - } - } -} \ No newline at end of file diff --git a/basics/trunk/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/basics/trunk/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java deleted file mode 100644 index 94b8d2d3..00000000 --- a/basics/trunk/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.test.tests; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class TrivialSamplesTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); - } - -} diff --git a/basics/trunk/testing/src/test/samples/1.xml b/basics/trunk/testing/src/test/samples/1.xml deleted file mode 100644 index bb9b5807..00000000 --- a/basics/trunk/testing/src/test/samples/1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/trunk/testing/src/test/samples/2.xml b/basics/trunk/testing/src/test/samples/2.xml deleted file mode 100644 index 3430661a..00000000 --- a/basics/trunk/testing/src/test/samples/2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/basics/trunk/tests/build-1.5.bat b/basics/trunk/tests/build-1.5.bat deleted file mode 100644 index aa55ff1e..00000000 --- a/basics/trunk/tests/build-1.5.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA5_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/trunk/tests/build-1.6.bat b/basics/trunk/tests/build-1.6.bat deleted file mode 100644 index 7e1760bf..00000000 --- a/basics/trunk/tests/build-1.6.bat +++ /dev/null @@ -1,4 +0,0 @@ -setlocal -set JAVA_HOME=%JAVA6_HOME% -call mvn clean install >std 2>err -endlocal \ No newline at end of file diff --git a/basics/trunk/tests/episodes/a/src/main/resources/a.xsd b/basics/trunk/tests/episodes/a/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/trunk/tests/episodes/a/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/episodes/a/src/main/resources/binding.xjb b/basics/trunk/tests/episodes/a/src/main/resources/binding.xjb deleted file mode 100644 index 2ca073df..00000000 --- a/basics/trunk/tests/episodes/a/src/main/resources/binding.xjb +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/basics/trunk/tests/episodes/a/src/test/samples/1.xml b/basics/trunk/tests/episodes/a/src/test/samples/1.xml deleted file mode 100644 index d12f0793..00000000 --- a/basics/trunk/tests/episodes/a/src/test/samples/1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - test - - \ No newline at end of file diff --git a/basics/trunk/tests/episodes/b/src/main/resources/a.xsd b/basics/trunk/tests/episodes/b/src/main/resources/a.xsd deleted file mode 100644 index 8065d53c..00000000 --- a/basics/trunk/tests/episodes/b/src/main/resources/a.xsd +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/episodes/b/src/main/resources/b.xsd b/basics/trunk/tests/episodes/b/src/main/resources/b.xsd deleted file mode 100644 index 64d95ed0..00000000 --- a/basics/trunk/tests/episodes/b/src/main/resources/b.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/episodes/b/src/main/resources/binding.xjb b/basics/trunk/tests/episodes/b/src/main/resources/binding.xjb deleted file mode 100644 index 2b1cbd24..00000000 --- a/basics/trunk/tests/episodes/b/src/main/resources/binding.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/basics/trunk/tests/episodes/b/src/test/samples/1.xml b/basics/trunk/tests/episodes/b/src/test/samples/1.xml deleted file mode 100644 index 912c84c3..00000000 --- a/basics/trunk/tests/episodes/b/src/test/samples/1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - test - - - test - - \ No newline at end of file diff --git a/basics/trunk/tests/ignoring/pom.xml b/basics/trunk/tests/ignoring/pom.xml deleted file mode 100644 index 9cc7e4ad..00000000 --- a/basics/trunk/tests/ignoring/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-ignoring - jar - JAXB2 Basics - Test [ignoring] - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -XtoString - -Xequals - -XhashCode - -Xcopyable - -Xmergeable - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/trunk/tests/ignoring/src/main/resources/schema.xsd b/basics/trunk/tests/ignoring/src/main/resources/schema.xsd deleted file mode 100644 index 26e1bb6f..00000000 --- a/basics/trunk/tests/ignoring/src/main/resources/schema.xsd +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/issues/.classpath b/basics/trunk/tests/issues/.classpath deleted file mode 100644 index b936c996..00000000 --- a/basics/trunk/tests/issues/.classpath +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/trunk/tests/issues/.project b/basics/trunk/tests/issues/.project deleted file mode 100644 index e6e2d74a..00000000 --- a/basics/trunk/tests/issues/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-issues - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java deleted file mode 100644 index 2b24842c..00000000 --- a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB14BaseClass { - -} diff --git a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java deleted file mode 100644 index 7b98b486..00000000 --- a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceFour { - -} diff --git a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java deleted file mode 100644 index f0b43210..00000000 --- a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceOne { - -} diff --git a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java deleted file mode 100644 index d5460571..00000000 --- a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceThree { - -} diff --git a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java deleted file mode 100644 index a3276945..00000000 --- a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB14BaseInterfaceTwo { - -} diff --git a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java deleted file mode 100644 index 77921c47..00000000 --- a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.locator.ObjectLocator; - -public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { - - @Override - public boolean equals(ObjectLocator leftLocator, - ObjectLocator rightLocator, Object lhs, Object rhs) { - if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { - // Quasi custom equals - return super.equals(leftLocator, rightLocator, lhs, rhs); - } else { - return super.equals(leftLocator, rightLocator, lhs, rhs); - } - } -} diff --git a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java b/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java deleted file mode 100644 index ff1fb59f..00000000 --- a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public interface IssueJIIB48Interface { - - public T getValue(); - -} diff --git a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java b/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java deleted file mode 100644 index 25d45a45..00000000 --- a/basics/trunk/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -public class IssueJIIB53ABaseClass { - -} diff --git a/basics/trunk/tests/issues/src/main/resources/binding.xjb b/basics/trunk/tests/issues/src/main/resources/binding.xjb deleted file mode 100644 index 947ed1a4..00000000 --- a/basics/trunk/tests/issues/src/main/resources/binding.xjb +++ /dev/null @@ -1,18 +0,0 @@ - - - - - java.lang.Cloneable - - - - java.lang.Cloneable - - - diff --git a/basics/trunk/tests/issues/src/main/resources/schema.xsd b/basics/trunk/tests/issues/src/main/resources/schema.xsd deleted file mode 100644 index 64b983aa..00000000 --- a/basics/trunk/tests/issues/src/main/resources/schema.xsd +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - java.lang.Cloneable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB48Interface<java.lang.String> - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53ABaseClass - - - - - - - - - - - org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53AType - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java deleted file mode 100644 index 3f4555ee..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.CopyStrategy; -import org.jvnet.jaxb2_commons.lang.EqualsStrategy; -import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final CopyStrategy copyStrategy = new JAXBCopyStrategy(); - final Object copy = copyStrategy.copy(null, original); - final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); - Assert.assertTrue("Source and copy must be equal.", equalsStrategy - .equals(null, null, original, copy)); - } - -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java deleted file mode 100644 index 37da5fa3..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.lang.reflect.Field; - -import javax.xml.bind.annotation.XmlAnyElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB10Test extends TestCase { - - public void testXmlAnyElementLax() throws Exception { - - final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); - final XmlAnyElement xmlAnyElementAnnotation = contentField - .getAnnotation(XmlAnyElement.class); - Assert.assertTrue(xmlAnyElementAnnotation.lax()); - } -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java deleted file mode 100644 index a46fed86..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB14Test extends TestCase { - - public void testIssueJIIB14() throws Exception { - Assert.assertEquals(IssueJIIB14BaseClass.class, - IssueJIIB14Element.class.getSuperclass()); - Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class - .isAssignableFrom(IssueJIIB14Element.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class - .isAssignableFrom(IssueJIIB14JAXBElement.class)); - } -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java deleted file mode 100644 index 746bc3b7..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB20Test extends TestCase { - - public void testException() throws Exception { - - final List strings = Arrays.asList("a", "b", "c"); - final IssueJIIB20 one = new IssueJIIB20(); - one.setStrings(strings); - Assert.assertEquals(strings, one.getStrings()); - Assert.assertSame(strings, one.getStrings()); - - } -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java deleted file mode 100644 index 82bf7def..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.jvnet.jaxb2_commons.lang.ContextUtils; - -public class JIIB35Test extends TestCase { - - public void testException() throws Exception { - - final ObjectFactory objectFactory = new ObjectFactory(); - - final IssueJIIB35 one = objectFactory.createIssueJIIB35(); - final IssueJIIB35 two = objectFactory.createIssueJIIB35(); - final IssueJIIB35 three = objectFactory.createIssueJIIB35(); - final IssueJIIB35 four = objectFactory.createIssueJIIB35(); - - final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); - - final String alpha = ContextUtils.toString(context, one); - two.hashCode(); - final String beta = ContextUtils.toString(context, two); - three.equals(null); - final String gamma = ContextUtils.toString(context, three); - four.toString(); - final String delta = ContextUtils.toString(context, four); - - Assert.assertEquals(alpha, beta); - Assert.assertEquals(beta, gamma); - Assert.assertEquals(gamma, delta); - - } -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java deleted file mode 100644 index 88df48c7..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB36Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB36 one = new IssueJIIB36(); - final IssueJIIB36 two = new IssueJIIB36(); - - Assert.assertTrue(one.equals(two)); - Assert.assertTrue(two.equals(one)); - Assert.assertEquals(one.hashCode(), two.hashCode()); - - } -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java deleted file mode 100644 index 7a2ff6b0..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB38Test extends TestCase { - - public void testException() throws Exception { - - final IssueJIIB38 one = new IssueJIIB38(); - final IssueJIIB38Type two = IssueJIIB38Type.A; - - Assert.assertTrue(one instanceof Cloneable); - Assert.assertTrue(two instanceof Cloneable); - - } -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java deleted file mode 100644 index 01ba2358..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB44Test extends TestCase { - - private JAXBContext context; - - @Override - protected void setUp() throws Exception { - context = JAXBContext.newInstance(getClass().getPackage().getName()); - } - - public void testReferencesPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_0.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testReferencesPropertyAsReferencePropertyType() - throws Exception { - - IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_1.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); - Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); - } - - public void testElementsPropertyAsElementPropertyType() throws Exception { - - IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context - .createUnmarshaller().unmarshal( - getClass().getResourceAsStream("issueJIIB44_2.xml"))) - .getValue(); - - Assert.assertEquals(3, value.getString().size()); - Assert.assertEquals(3, value.getInt().size()); - } -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java deleted file mode 100644 index 008cc7ca..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.Arrays; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class JIIB8Test extends TestCase { - - public void testCollectionSetters() throws Exception { - - final IssueJIIB8Type one = new IssueJIIB8Type(); - - one.setValue(Arrays.asList("1", "2", "3")); - - Assert.assertEquals(3, one.getValue().size()); - - } -} diff --git a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java deleted file mode 100644 index 2ea29226..00000000 --- a/basics/trunk/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.issues; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunIssuesPlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); -// args.add("-XelementWrapper"); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xsetters-mode=direct"); - args.add("-Xwildcard"); - args.add("-XautoInheritance"); - args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); - args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); - args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); - args.add("-Xannotate"); - args.add("-Xsimplify"); - return args; - } - -} diff --git a/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml deleted file mode 100644 index 0915dfad..00000000 --- a/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml deleted file mode 100644 index b811fb9b..00000000 --- a/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml deleted file mode 100644 index 0008e3ee..00000000 --- a/basics/trunk/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml +++ /dev/null @@ -1,8 +0,0 @@ - - a - b - 0 - c - 1 - 2 - \ No newline at end of file diff --git a/basics/trunk/tests/issues/src/test/samples/issue16[0].xml b/basics/trunk/tests/issues/src/test/samples/issue16[0].xml deleted file mode 100644 index 7efd4319..00000000 --- a/basics/trunk/tests/issues/src/test/samples/issue16[0].xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/one/.classpath b/basics/trunk/tests/one/.classpath deleted file mode 100644 index 95482320..00000000 --- a/basics/trunk/tests/one/.classpath +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/trunk/tests/one/.project b/basics/trunk/tests/one/.project deleted file mode 100644 index 855cd8c9..00000000 --- a/basics/trunk/tests/one/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-one - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/trunk/tests/one/.settings/org.eclipse.core.resources.prefs b/basics/trunk/tests/one/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 90d24a88..00000000 --- a/basics/trunk/tests/one/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding//target/generated-sources/xjc=UTF-8 -encoding/=UTF-8 diff --git a/basics/trunk/tests/one/.settings/org.eclipse.jdt.core.prefs b/basics/trunk/tests/one/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/trunk/tests/one/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/trunk/tests/one/src/main/resources/binding.xjb b/basics/trunk/tests/one/src/main/resources/binding.xjb deleted file mode 100644 index 3888abb4..00000000 --- a/basics/trunk/tests/one/src/main/resources/binding.xjb +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - diff --git a/basics/trunk/tests/one/src/main/resources/schema.xsd b/basics/trunk/tests/one/src/main/resources/schema.xsd deleted file mode 100644 index e527b565..00000000 --- a/basics/trunk/tests/one/src/main/resources/schema.xsd +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java deleted file mode 100644 index c9db583c..00000000 --- a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import junit.framework.Assert; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class CopyableTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object original = createContext().createUnmarshaller().unmarshal( - sample); - final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); - Assert.assertTrue("Source and copy must be equal.", - JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); - } - -} diff --git a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java deleted file mode 100644 index 0c455a91..00000000 --- a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( - null, null, lhs, rhs)); - } -} diff --git a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java deleted file mode 100644 index 5af73456..00000000 --- a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; -import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class HashCodeTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object lhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object rhs = createContext().createUnmarshaller().unmarshal( - sample); - final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); - final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, lhs); - final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, rhs); - final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, - 0, chs); - assertEquals("Values must be equal.", leftHashCode, rightHashCode); - assertEquals("Values must be equal.", leftHashCode, copyHashCode); - } -} diff --git a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java deleted file mode 100644 index 080f21a2..00000000 --- a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.util.ArrayList; -import java.util.List; - -import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; -import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; - -public class RunOnePlugin extends RunXJC2Mojo { - - @Override - protected void configureMojo(AbstractXJC2Mojo mojo) { - super.configureMojo(mojo); - mojo.setExtension(true); - mojo.setForceRegenerate(true); - mojo.setDebug(false); - } - - @Override - public List getArgs() { - final List args = new ArrayList(super.getArgs()); - args.add("-XtoString"); - args.add("-Xequals"); - args.add("-XhashCode"); - args.add("-Xcopyable"); - args.add("-Xmergeable"); - args.add("-Xinheritance"); - args.add("-Xsetters"); - args.add("-Xwildcard"); - return args; - } - -} diff --git a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java deleted file mode 100644 index 94f20dc2..00000000 --- a/basics/trunk/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.one; - -import java.io.File; - -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; -import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; - -public class ToStringTest extends AbstractSamplesTest { - - @Override - protected void checkSample(File sample) throws Exception { - - final Object object = createContext().createUnmarshaller().unmarshal(sample); - System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); - } - -} diff --git a/basics/trunk/tests/one/src/test/resources/log4j.properties b/basics/trunk/tests/one/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/trunk/tests/one/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/trunk/tests/one/src/test/samples/1.xml b/basics/trunk/tests/one/src/test/samples/1.xml deleted file mode 100644 index fc2c3835..00000000 --- a/basics/trunk/tests/one/src/test/samples/1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - a - b - c - d - e - - 0 - 1 - - diff --git a/basics/trunk/tests/one/src/test/samples/2.xml b/basics/trunk/tests/one/src/test/samples/2.xml deleted file mode 100644 index eedb2988..00000000 --- a/basics/trunk/tests/one/src/test/samples/2.xml +++ /dev/null @@ -1,4 +0,0 @@ - - a - 2001-01-01T00:00:00 - diff --git a/basics/trunk/tests/wildcard/.classpath b/basics/trunk/tests/wildcard/.classpath deleted file mode 100644 index b936c996..00000000 --- a/basics/trunk/tests/wildcard/.classpath +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/trunk/tests/wildcard/.project b/basics/trunk/tests/wildcard/.project deleted file mode 100644 index 0636b2c4..00000000 --- a/basics/trunk/tests/wildcard/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-test-wildcard - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/trunk/tests/wildcard/.settings/org.eclipse.core.resources.prefs b/basics/trunk/tests/wildcard/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index dd79ee7b..00000000 --- a/basics/trunk/tests/wildcard/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding//target/generated-sources/xjc=UTF-8 -encoding/=UTF-8 diff --git a/basics/trunk/tests/wildcard/.settings/org.eclipse.jdt.core.prefs b/basics/trunk/tests/wildcard/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 14f521d2..00000000 --- a/basics/trunk/tests/wildcard/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/trunk/tests/wildcard/pom.xml b/basics/trunk/tests/wildcard/pom.xml deleted file mode 100644 index dcb22a75..00000000 --- a/basics/trunk/tests/wildcard/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - org.jvnet.jaxb2_commons - jaxb2-basics-tests - 0.7.1-SNAPSHOT - ../pom.xml - - jaxb2-basics-test-wildcard - jar - JAXB2 Basics - Test [wildcard] - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin-testing - test - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - test - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - true - - -Xwildcard - - - - org.jvnet.jaxb2_commons - jaxb2-basics - - - - - - - diff --git a/basics/trunk/tests/wildcard/src/main/resources/binding.xjb b/basics/trunk/tests/wildcard/src/main/resources/binding.xjb deleted file mode 100644 index 8f780f74..00000000 --- a/basics/trunk/tests/wildcard/src/main/resources/binding.xjb +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/basics/trunk/tests/wildcard/src/main/resources/schema.xsd b/basics/trunk/tests/wildcard/src/main/resources/schema.xsd deleted file mode 100644 index 7d520ce9..00000000 --- a/basics/trunk/tests/wildcard/src/main/resources/schema.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/zj/src/main/resources/ObisData.xsd b/basics/trunk/tests/zj/src/main/resources/ObisData.xsd deleted file mode 100644 index 43365b12..00000000 --- a/basics/trunk/tests/zj/src/main/resources/ObisData.xsd +++ /dev/null @@ -1,688 +0,0 @@ - - - - - - - Ex: The width of an A0 roll or the size of a letter cut sheet - - - - - - - - - Ex: The ISO A media series - - - - - - - - - - - - Ex: The detailed description of all the resources that have changed since the last query. - - - - - - - - - - Ex: A metric data type - - - - - - - - - - - - - The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. - - - - - - - - - - - - - - - - The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. - - - - - - - - - - - - - The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. - - - - - - - - - - - - - The print catalogue lists all the printers installed on the customer site. - - - - - - - - - - - - - - - - - - - - - - - The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The stamp catalogue lists all the stamps installed on the customer site. - - - - - - - - - - - - - The pen catalogue lists all the pens and set of pens installed on the customer site. - - - - - - - - - - - - - The color catalogue lists all the color profiles installed on the customer site. - - - - - - - - - - - - - - - - - - - A resource can be a media, a media type, a media size, a stamp, etc... - - - - - - - - - - The server offers submission queues and print capabilities to submit jobs to these queues. - - - - - - - - - - - - - A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. - - - - - - - - - - A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. - - - - - - - - - - - - - - An emulation is the complete or partial support of a page description language. - - - - - - - - - - - - Inks are used to print documents. - - - - - - - - - - - - - - - - - - - - - - - - - A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. - - - - - - - - - - - - - - - - - - - - A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... - - - - - - - - - - A color profile is a resource that specifies the parameters of a color space. - - - - - - - - - - - The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. - - - - - - - - - - - - A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. - - - - - - - - - - - - - - - - - - - - A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. - - - - - - - - - A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The job ticket expresses how a set of documents (a job) shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The document ticket expresses how a document shall be printed. - - - - - - - - - - - - - - - The page ticket expresses how one or more pages of a document shall be printed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. - - - - - - - - - - - - - \ No newline at end of file diff --git a/basics/trunk/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/basics/trunk/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java deleted file mode 100644 index ca65c408..00000000 --- a/basics/trunk/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jvnet.jaxb2_commons.tests.zj; - -import java.io.File; - -import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; -import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; - -public class EqualsTest extends AbstractSamplesTest { - - @Override - public String getContextPath() { - return "com.oce.obis.sei.api.data"; - } - - @Override - protected void checkSample(File sample) throws Exception { - final Object lhs = createContext().createUnmarshaller().unmarshal(sample); - final Object rhs = createContext().createUnmarshaller().unmarshal(sample); - assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); - } -} diff --git a/basics/trunk/tests/zj/src/test/resources/log4j.properties b/basics/trunk/tests/zj/src/test/resources/log4j.properties deleted file mode 100644 index c632d799..00000000 --- a/basics/trunk/tests/zj/src/test/resources/log4j.properties +++ /dev/null @@ -1,5 +0,0 @@ -log4j.rootCategory=DEBUG, stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.target=system.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/basics/trunk/tests/zj/src/test/samples/MediaCatalogue.xml b/basics/trunk/tests/zj/src/test/samples/MediaCatalogue.xml deleted file mode 100644 index d88a21eb..00000000 --- a/basics/trunk/tests/zj/src/test/samples/MediaCatalogue.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 1 - first roll - This is the first roll - 1111 - 11 - - - 123 - second roll - This is the second roll - 2222 - 22 - - - - - 1 - first roll size - This is the first roll size - 111 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - 2 - second roll size - This is the second roll size - 222 - - 5 - 6 - 7 - 8 - - - 1 - 2 - 3 - 4 - - - - diff --git a/basics/trunk/tools/.classpath b/basics/trunk/tools/.classpath deleted file mode 100644 index 66a73b05..00000000 --- a/basics/trunk/tools/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basics/trunk/tools/.project b/basics/trunk/tools/.project deleted file mode 100644 index e7b0094b..00000000 --- a/basics/trunk/tools/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - jaxb2-basics-tools - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java deleted file mode 100644 index 290a380b..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.io.IOException; - -import org.apache.commons.beanutils.BeanUtils; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; - -/** - * Abstract base class for parameterizable JAXB plugins. - *

- * This plugin looks for the arguments of the form - * -myPlugin-name=value - * (myPlugin is the plugin option name) and - * then invokes setName(value) on itself.

- *

For instance, the argument -Xfoo-bar=test triggers - * setBar("test") invocation.

- *

Values are injected using Commons BeanUtils as bean properties, so - * types will be converted correspondingly - * - * @author valikov - */ -public abstract class AbstractParameterizablePlugin extends AbstractPlugin { - - /** - * Parses the arguments and injects values into the beans via properties. - */ - public int parseArgument(Options opt, String[] args, int start) - throws BadCommandLineException, IOException { - - int consumed = 0; - final String optionPrefix = "-" + getOptionName() + "-"; - final int optionPrefixLength = optionPrefix.length(); - - final String arg = args[start]; - final int equalsPosition = arg.indexOf('='); - - if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { - final String propertyName = arg.substring(optionPrefixLength, - equalsPosition); - - 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 + "]."); - } - } - return consumed; - } -} \ No newline at end of file diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java deleted file mode 100644 index f67cc957..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.Plugin; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPlugin extends Plugin { - - /** - * Plugin logger. - */ - protected Log logger = LogFactory.getLog(getClass()); - - @Override - public void onActivated(Options options) throws BadCommandLineException { - super.onActivated(options); - try { - init(options); - } catch (Exception ex) { - throw new BadCommandLineException( - "Could not initialize the plugin [" + getOptionName() - + "].", ex); - } - } - - @Override - public boolean run(Outline outline, Options options, - ErrorHandler errorHandler) throws SAXException { - /* - * try { init(options); } catch (Exception ex) { SAXParseException saxex - * = new SAXParseException( "Could not initialize Spring context.", - * null, ex); errorHandler.fatalError(saxex); throw saxex; } - */ - try { - beforeRun(outline, options); - return run(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - } finally { - try { - afterRun(outline, options); - } catch (Exception ex) { - final SAXParseException saxex = new SAXParseException( - "Error during plugin execution.", null, ex); - errorHandler.error(saxex); - throw saxex; - - } - } - } - - protected void beforeRun(Outline outline, Options options) throws Exception { - - } - - protected boolean run(Outline outline, Options options) throws Exception { - return true; - } - - protected void afterRun(Outline outline, Options options) throws Exception { - - } - - protected void init(Options options) throws Exception { - } - - public Collection getCustomizationElementNames() { - return Collections. emptyList(); - } - - private List customizationURIs; - - private Set customizationElementNames; - - @Override - public List getCustomizationURIs() { - if (this.customizationURIs == null) { - final Collection customizationElementNames = getCustomizationElementNames(); - this.customizationURIs = new ArrayList( - customizationElementNames.size()); - for (QName customizationElementName : customizationElementNames) { - final String namespaceURI = customizationElementName - .getNamespaceURI(); - if (!(namespaceURI== null || namespaceURI.length() == 0)) { - this.customizationURIs.add(namespaceURI); - } - } - } - return this.customizationURIs; - } - - @Override - public boolean isCustomizationTagName(String namespaceURI, String localName) { - if (this.customizationElementNames == null) { - this.customizationElementNames = new HashSet( - getCustomizationElementNames()); - } - return this.customizationElementNames.contains(new QName(namespaceURI, - localName)); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java deleted file mode 100644 index d3644156..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.plugin.spring; - -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import com.sun.tools.xjc.BadCommandLineException; -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSpringConfigurablePlugin extends - AbstractParameterizablePlugin { - - protected Log logger = LogFactory.getLog(getClass()); - - private AbstractXmlApplicationContext applicationContext; - - public AbstractXmlApplicationContext getApplicationContext() { - return applicationContext; - } - - protected String[] getDefaultConfigLocations() { - return null; - } - - private String[] configLocations = getDefaultConfigLocations(); - - public String[] getConfigLocations() { - return configLocations; - } - - public void setConfigLocations(String[] configLocations) { - this.configLocations = configLocations; - } - - protected int getAutowireMode() { - return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; - } - - protected boolean isDependencyCheck() { - return false; - } - - public void init(Options options) throws Exception { - - } - - @Override - protected void beforeRun(Outline outline, Options options) throws Exception { - super.beforeRun(outline, options); - final String[] configLocations = getConfigLocations(); - if (!ArrayUtils.isEmpty(configLocations)) { - final String configLocationsString = ArrayUtils - .toString(configLocations); - logger.debug("Loading application context from [" - + configLocationsString + "]."); - try { - applicationContext = new FileSystemXmlApplicationContext( - configLocations, false); - applicationContext.setClassLoader(Thread.currentThread() - .getContextClassLoader()); - applicationContext.refresh(); - if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { - applicationContext.getBeanFactory().autowireBeanProperties( - this, getAutowireMode(), isDependencyCheck()); - } - } catch (Exception ex) { - ex.printStackTrace(); - ex.getCause().printStackTrace(); - logger.error("Error loading applicaion context from [" - + configLocationsString + "].", ex); - throw new BadCommandLineException( - "Error loading applicaion context from [" - + configLocationsString + "].", ex); - } - } - } - -} \ No newline at end of file diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java deleted file mode 100644 index c849003e..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; - -public interface ClassOutlineProcessor { - public T process(C context, ClassOutline classOutline, Options options) throws Exception; - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java deleted file mode 100644 index f9cd2744..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldOutlineProcessor { - public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java deleted file mode 100644 index 98dc020e..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineProcessor { - - public T process(C context, Outline outline, Options options) throws Exception; - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java deleted file mode 100644 index f5321a6f..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.PackageOutline; - -public interface PackageOutlineProcessor { - public T process(C context, PackageOutline packageOutline, Options options) - throws Exception; - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java deleted file mode 100644 index b8ced32b..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.jvnet.jaxb2_commons.strategy.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; -import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; - -import com.sun.tools.xjc.Options; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class DefaultOutlineProcessor implements - OutlineProcessor, C> { - - private final ClassOutlineProcessor classOutlineProcessor; - - public DefaultOutlineProcessor( - final ClassOutlineProcessor classOutlineProcessor) { - this.classOutlineProcessor = classOutlineProcessor; - } - - public ClassOutlineProcessor getClassOutlineProcessor() { - return classOutlineProcessor; - } - - public Map process(C context, Outline outline, - Options options) throws Exception { - - final Map classMappingsMap = new HashMap(); - for (final ClassOutline classOutline : outline.getClasses()) { - final T result = getClassOutlineProcessor().process(context, - classOutline, options); - if (result != null) { - classMappingsMap.put(classOutline, result); - } - } - return classMappingsMap; - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java deleted file mode 100644 index d66a028a..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; - -public class ClassUtils { - - // public static String getClassName(final ClassOutline classOutline) { - // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); - // } - // - - public static boolean contains(JDefinedClass theClass, String innerClassName) { - - for (final Iterator classes = theClass.classes(); classes - .hasNext();) { - final JDefinedClass innerClass = classes.next(); - if (innerClassName.equals(innerClass.name())) - return true; - } - return false; - } - - public static void _implements(JDefinedClass theClass, JClass theInterface) { - if (!isImplementing(theClass, theInterface)) - theClass._implements(theInterface); - } - - public static boolean isImplementing(JDefinedClass theClass, - JClass theInterface) { - for (Iterator iterator = theClass._implements(); iterator - .hasNext();) { - final JClass implementedInterface = iterator.next(); - if (theInterface.equals(implementedInterface)) { - return true; - } - } - return false; - } - - public static List getAncestors(ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - public static List getAncestorsAndSelf( - ClassOutline classOutline) { - final List classOutlines = new LinkedList(); - classOutlines.add(classOutline); - addAncestors(classOutline, classOutlines); - return classOutlines; - } - - private static void addAncestors(ClassOutline classOutline, - List classOutlines) { - if (classOutline.getSuperClass() != null) { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - addAncestors(superClassOutline, classOutlines); - } - } - - public static FieldOutline[] getFields(ClassOutline classOutline) { - final List fields = new ArrayList(); - fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); - if (classOutline.getSuperClass() != null) { - fields.addAll(Arrays - .asList(getFields(classOutline.getSuperClass()))); - } - return fields.toArray(new FieldOutline[fields.size()]); - } - - public static String getPackagedClassName(final CClassInfo classInfo) { - - if (classInfo.parent() instanceof CClassInfo) { - return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' - + classInfo.shortName; - } else { - final String r = classInfo.parent().fullName(); - if (r.length() == 0) - return classInfo.shortName; - else - return r + '.' + classInfo.shortName; - } - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java deleted file mode 100644 index 12c98085..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JClassAlreadyExistsException; -import com.sun.codemodel.JClassContainer; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JPackage; -import com.sun.codemodel.JPrimitiveType; -import com.sun.codemodel.JResourceFile; -import com.sun.codemodel.JStatement; -import com.sun.codemodel.JType; -import com.sun.codemodel.fmt.JPropertyFile; -import com.sun.tools.xjc.outline.ClassOutline; - -/** - * Property file utilities. - * - * @author valikov - */ -public class CodeModelUtils { - private CodeModelUtils() { - } - - /** - * Returns a property file (created if necessary). - * - * @param thePackage - * package to create property file - * @param name - * property file name. - * @return Property file. - */ - - public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, - String name) { - JPropertyFile propertyFile = null; - for (Iterator iterator = thePackage.propertyFiles(); iterator - .hasNext() && (null == propertyFile);) { - final JResourceFile resourceFile = (JResourceFile) iterator.next(); - if (resourceFile instanceof JPropertyFile - && name.equals(resourceFile.name())) { - propertyFile = (JPropertyFile) resourceFile; - } - } - - if (null == propertyFile) { - propertyFile = new JPropertyFile(name); - thePackage.addResourceFile(propertyFile); - } - return propertyFile; - } - - // public static boolean doesImplement(JDefinedClass theClass, JClass - // theInterface) - // { - // theClass._i - // } - - public static String getClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getLocalClassName(theClass.outer()) + "$" + theClass.name()); - } - - public static String getDottedLocalClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.name() - : getDottedLocalClassName(theClass.outer()) + "." - + theClass.name()); - } - - public static String getPackagedClassName(final JClass theClass) { - return (theClass.outer() == null ? theClass.fullName() - : getPackagedClassName(theClass.outer()) + "$" - + theClass.name()); - } - - public static JClass box(JType t) { - if (t instanceof JClass) - return (JClass) t; - else - return ((JPrimitiveType) t).boxify(); - } - - public static JDefinedClass getOrCreateClass(JClassContainer container, - int flags, String name) { - try { - return container._class(flags, name); - } catch (JClassAlreadyExistsException jcaeex) { - return jcaeex.getExistingClass(); - } - } - - public static JDefinedClass getOrCreateClass(JCodeModel codeModel, - int flags, String fullClassName) { - final String packageName; - final String className; - final int lastDotIndex = fullClassName.lastIndexOf('.'); - if (lastDotIndex >= 0) { - packageName = fullClassName.substring(0, lastDotIndex); - className = fullClassName.substring(lastDotIndex + 1); - } else { - packageName = ""; - className = fullClassName; - } - final JPackage thePackage = codeModel._package(packageName); - return getOrCreateClass(thePackage, flags, className); - } - - public static JStatement split(JDefinedClass theClass, - JStatement[] statements, String prefix, int start, int length, - int threshold) { - final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, - theClass.owner().VOID, prefix); - if (length < threshold) { - for (int index = start; (index - start) < length; index++) { - final JStatement statement = statements[index]; - method.body().add(statement); - } - } else { - method.body().add( - split(theClass, statements, prefix + "_0", start, - length / 2, threshold)); - method.body().add( - split(theClass, statements, prefix + "_1", start + length - / 2, length - (length / 2), threshold)); - } - return JExpr.invoke(method); - } - - public static JMethod getMethod(JDefinedClass theClass, String name, - JType[] arguments) { - final JMethod method = theClass.getMethod(name, arguments); - if (method != null) { - return method; - } else { - final JClass draftSuperClass = theClass._extends(); - if (draftSuperClass == null - || !(draftSuperClass instanceof JDefinedClass)) { - return null; - } else { - final JDefinedClass superClass = (JDefinedClass) draftSuperClass; - return getMethod(superClass, name, arguments); - } - } - } - - public static JMethod getMethod(final JDefinedClass theClass, - final String name) { - for (JMethod method : theClass.methods()) { - if (method.name().equals(name)) - return method; - } - return null; - } - - public static JMethod getMethod(final ClassOutline classOutline, - final String name) { - final JDefinedClass ref = classOutline.ref; - final JMethod method = getMethod(ref, name); - if (method != null) { - return method; - } else { - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline == null) { - return null; - } else { - return getMethod(superClassOutline, name); - } - } - } - - public static JCodeModel getCodeModel(ClassOutline classOutline) { - return classOutline.ref.owner(); - } - - public static JType ref(JCodeModel codeModel, String className) { - try { - // try the context class loader first - return codeModel.ref(Thread.currentThread().getContextClassLoader() - .loadClass(className)); - } catch (ClassNotFoundException e) { - // fall through - } - // then the default mechanism. - try { - return codeModel.ref(Class.forName(className)); - } catch (ClassNotFoundException e1) { - // fall through - } - - { - JDefinedClass _class = _getClass(codeModel, className); - if (_class != null) { - return _class; - } - } - return codeModel.ref(className.replace('$', '.')); - } - - public static JDefinedClass _getClass(JCodeModel codeModel, - String fullyQualifiedName) { - final int idx = fullyQualifiedName.lastIndexOf('.'); - if (idx < 0) { - return codeModel.rootPackage()._getClass(fullyQualifiedName); - } else { - final String packageName = fullyQualifiedName.substring(0, idx); - for (Iterator iterator = codeModel.packages(); iterator - .hasNext();) { - final JPackage _package = iterator.next(); - if (packageName.equals(_package.name())) { - return _getClass(_package, - fullyQualifiedName.substring(idx + 1)); - } - } - return null; - } - - } - - public static JDefinedClass _getClass(JPackage _package, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - return _package._getClass(name); - } else { - final String parentClassName = name.substring(0, idx); - final JDefinedClass parentClass = _package - ._getClass(parentClassName); - if (parentClass == null) { - return null; - } else { - return _getClass(parentClass, name.substring(idx + 1)); - } - - } - - } - - public static JDefinedClass _getClass(JDefinedClass _class, String name) { - final int idx = name.lastIndexOf('$'); - if (idx < 0) { - for (Iterator nestedClasses = _class.classes(); nestedClasses - .hasNext();) { - final JDefinedClass nestedClass = nestedClasses.next(); - if (nestedClass.name().equals(name)) { - return nestedClass; - } - } - return null; - - } else { - final JDefinedClass nestedClass = _getClass(_class, - name.substring(0, idx)); - if (nestedClass == null) { - return null; - } else { - return _getClass(nestedClass, name.substring(idx + 1)); - } - } - } - -} \ No newline at end of file diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java deleted file mode 100644 index 176d5a2c..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java +++ /dev/null @@ -1,654 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CCustomizable; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CElement; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPluginCustomization; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CPropertyVisitor; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CustomizationUtils { - - private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; - - static { - DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - // try { - // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - // } catch (ParserConfigurationException pce) { - // throw new ExceptionInInitializerError(pce); - // } - } - - public static DocumentBuilder getDocumentBuilder() { - try { - return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); - } catch (ParserConfigurationException pce) { - throw new AssertionError(pce); - } - } - - public static CPluginCustomization createCustomization(QName name) { - final Document document = getDocumentBuilder().newDocument(); - final Element element = document.createElementNS( - name.getNamespaceURI(), name.getLocalPart()); - return createCustomization(element); - } - - public static CPluginCustomization createCustomization(final Element element) { - final CPluginCustomization customization = new CPluginCustomization( - element, null); - return customization; - } - - public static boolean containsCustomization(Outline outline, QName name) { - final CPluginCustomization customization = findCustomization(outline, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(Model model, QName name) { - final CPluginCustomization customization = findCustomization(model, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(ClassOutline classOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - classOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(EnumOutline enumOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - enumOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CClassInfo classInfo, QName name) { - final CPluginCustomization customization = findCustomization(classInfo, - name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - ClassOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - EnumOutline classOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - ElementOutline elementOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static List findCustomizations( - ClassOutline classOutline, QName name) { - return findCustomizations(classOutline.target, name); - } - - public static List findCustomizations( - EnumOutline enumOutline, QName name) { - return findCustomizations(enumOutline.target, name); - } - - public static List findCustomizations( - ElementOutline elementOutline, QName name) { - return findCustomizations(elementOutline.target, name); - } - - public static List findCustomizations( - CClassInfo classInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CEnumLeafInfo enumInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static List findCustomizations( - Outline outline, QName name) { - return findCustomizations(outline.getModel(), name); - } - - public static List findCustomizations(Model model, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - - final List pluginCustomizations = new LinkedList(); - - for (CPluginCustomization pluginCustomization : customizations) { - if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( - name.getNamespaceURI()) - && fixNull(pluginCustomization.element.getLocalName()) - .equals(name.getLocalPart())) { - pluginCustomization.markAsAcknowledged(); - pluginCustomizations.add(pluginCustomization); - } - } - - return pluginCustomizations; - } - - public static CPluginCustomization findCustomization(CClassInfo classInfo, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(classInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CEnumLeafInfo enumLeafInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(enumLeafInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CElementInfo elementInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(elementInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static boolean containsCustomization(FieldOutline fieldOutline, - QName name) { - final CPluginCustomization customization = findCustomization( - fieldOutline, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - enumLeafInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static boolean containsCustomization(CPropertyInfo propertyInfo, - QName name) { - final CPluginCustomization customization = findCustomization( - propertyInfo, name); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization != null; - } - - public static CPluginCustomization findCustomization( - FieldOutline fieldOutline, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization( - CPropertyInfo propertyInfo, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Outline outline, - QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(outline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - public static CPluginCustomization findCustomization(Model model, QName name) { - final CCustomizations customizations = CustomizationUtils - .getCustomizations(model); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) { - customization.markAsAcknowledged(); - } - return customization; - } - - // public static BIXPluginCustomization getCustomization(JavaItem item, - // QName name) { - // final BIXPluginCustomization[] customizations = getCustomizations(item, - // name); - // if (customizations == null || customizations.length < 1) { - // return null; - // } - // else { - // return customizations[0]; - // } - // } - - public static FieldOutline findFieldWithCustomization( - ClassOutline classOutline, final QName name) { - - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - final CCustomizations customizations = getCustomizations(fieldOutline); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return fieldOutline; - } - return null; - - } - - public static CPropertyInfo findPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - final CCustomizations customizations = getCustomizations(propertyInfo); - final CPluginCustomization customization = customizations.find( - name.getNamespaceURI(), name.getLocalPart()); - if (customization != null) - return propertyInfo; - } - return null; - } - - public static FieldOutline findInheritedFieldWithCustomization( - ClassOutline classOutline, final QName name) { - for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { - if (containsCustomization(fieldOutline, name)) { - return fieldOutline; - } - } - final ClassOutline superClassOutline = classOutline.getSuperClass(); - if (superClassOutline != null) { - return findInheritedFieldWithCustomization(superClassOutline, name); - } else { - return null; - } - } - - public static CPropertyInfo findInheritedPropertyWithCustomization( - CClassInfo classInfo, final QName name) { - for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { - if (containsCustomization(propertyInfo, name)) { - return propertyInfo; - } - } - final CClassInfo superClassInfo = classInfo.getBaseClass(); - if (superClassInfo != null) { - return findInheritedPropertyWithCustomization(superClassInfo, name); - } else { - return null; - } - } - - public static CCustomizations getCustomizations( - ElementOutline elementOutline) { - return getCustomizations(elementOutline.target); - } - - public static CCustomizations getCustomizations( - final CElementInfo elementInfo) { - return elementInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations(EnumOutline enumOutline) { - return getCustomizations(enumOutline.target); - } - - public static CCustomizations getCustomizations( - EnumConstantOutline enumConstantOutline) { - return getCustomizations(enumConstantOutline.target); - } - - public static CCustomizations getCustomizations(FieldOutline fieldOutline) { - return getCustomizations(fieldOutline.getPropertyInfo()); - } - - public static CCustomizations getCustomizations(final Outline outline) { - return getCustomizations(outline.getModel()); - } - - public static CCustomizations getCustomizations(final Model model) { - final CCustomizations main = new CCustomizations( - model.getCustomizations()); - return main; - } - - public static CCustomizations getCustomizations( - final CPropertyInfo propertyInfo) { - - final CCustomizations main = new CCustomizations( - propertyInfo.getCustomizations()); - - final Collection elementCustomizations = propertyInfo - .accept(new CPropertyVisitor>() { - public Collection onAttribute( - CAttributePropertyInfo info) { - return Collections.emptyList(); - } - - public Collection onElement( - CElementPropertyInfo arg0) { - return Collections.emptyList(); - } - - public Collection onReference( - CReferencePropertyInfo info) { - - final List elementCustomizations = new ArrayList( - info.getElements().size()); - - for (CElement element : info.getElements()) { - if (!(element instanceof CElementInfo && ((CElementInfo) element) - .hasClass())) { - elementCustomizations.add(element - .getCustomizations()); - } - } - - return elementCustomizations; - } - - public Collection onValue( - CValuePropertyInfo arg0) { - return Collections.emptyList(); - }; - - }); - - CCustomizations customizations = main; - - for (CCustomizations e : elementCustomizations) { - main.addAll(e); - } - - return customizations; - } - - public static CCustomizations getCustomizations(ClassOutline classOutline) { - return getCustomizations(classOutline.target); - } - - public static CCustomizations getCustomizations(final CClassInfo classInfo) { - return classInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumLeafInfo enumLeafInfo) { - return enumLeafInfo.getCustomizations(); - } - - public static CCustomizations getCustomizations( - final CEnumConstant enumConstant) { - final Object _enumConstant = enumConstant; - if (_enumConstant instanceof CCustomizable) { - return ((CCustomizable) _enumConstant).getCustomizations(); - } else { - return CCustomizations.EMPTY; - } - } - - private static String fixNull(String s) { - if (s == null) { - return ""; - } else { - return s; - } - } - - public static Object unmarshall(final JAXBContext context, - final CPluginCustomization customization) throws AssertionError { - if (customization == null) { - return null; - } else - - { - final Unmarshaller unmarshaller; - try { - unmarshaller = context.createUnmarshaller(); - } catch (JAXBException ex) { - final AssertionError error = new AssertionError( - "Unmarshaller could not be created."); - error.initCause(ex); - throw error; - } - - try { - final Object result = unmarshaller.unmarshal(new DOMSource( - customization.element)); - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - if (introspector.isElement(result)) { - return JAXBIntrospector.getValue(result); - } else { - return result; - } - } catch (JAXBException ex) { - throw new IllegalArgumentException( - "Could not unmarshal the customization.", ex); - } - - } - } - - public static CPluginCustomization marshal(final JAXBContext context, - final QName name, final Object object) { - - try { - - final JAXBIntrospector introspector = context - .createJAXBIntrospector(); - - final Object value; - { - if (introspector.isElement(object)) { - value = object; - } else { - @SuppressWarnings("unchecked") - final JAXBElement jaxbElement = new JAXBElement(name, - object.getClass(), object); - value = jaxbElement; - } - - } - - final Marshaller marshaller = context.createMarshaller(); - - final DOMResult result = new DOMResult(); - - marshaller.marshal(value, result); - - final Node node = result.getNode(); - - final Element element; - if (node instanceof Element) - - { - element = (Element) node; - } else if (node instanceof Document) { - element = ((Document) node).getDocumentElement(); - } else { - element = null; - throw new IllegalArgumentException( - "Could not marhsall object into an element."); - } - return new CPluginCustomization(element, null); - } catch (JAXBException jaxbex) { - throw new IllegalArgumentException( - "Could not marhsall object into an element.", jaxbex); - - } - } - - public static CPluginCustomization addCustomization( - CCustomizable customizable, JAXBContext context, QName name, - Object object) { - final CPluginCustomization customization = marshal(context, name, - object); - customizable.getCustomizations().add(customization); - return customization; - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java deleted file mode 100644 index 559b7b97..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public interface FieldAccessorFactory { - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java deleted file mode 100644 index f9549b80..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldOutline; - -public class FieldAccessorUtils { - - private static final JType[] NONE = new JType[0]; - - public static JMethod getter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); - if (getgetter != null) { - return getgetter; - } else { - final JMethod isgetter = theClass - .getMethod("is" + publicName, NONE); - if (isgetter != null) { - return isgetter; - } else { - return null; - } - } - } - - /** - * Returns the isSetProperty() method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The isSetProperty() method for the given field - * outline or null if no such method exists. - */ - public static JMethod issetter(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "isSet" + publicName; - return theClass.getMethod(name, NONE); - } - - /** - * Returns the field for the given field outline or null if no - * such field exists. - * - * @param fieldOutline - * field outline. - * @return The field for the given field outline or null if no - * such field exists. - */ - public static JFieldVar field(FieldOutline fieldOutline) { - final JDefinedClass theClass = fieldOutline.parent().implClass; - return theClass.fields().get( - fieldOutline.getPropertyInfo().getName(false)); - } - - /** - * Returns the setProperty(...) method for the given field - * outline or null if no such method exists. - * - * @param fieldOutline - * field outline. - * @return The setProperty(...) method for the given field - * outline or null if no such method exists. - */ - public static JMethod setter(FieldOutline fieldOutline) { - - final JMethod getter = getter(fieldOutline); - final JType type = getter != null ? getter.type() : fieldOutline - .getRawType(); - final JDefinedClass theClass = fieldOutline.parent().implClass; - final String publicName = fieldOutline.getPropertyInfo().getName(true); - final String name = "set" + publicName; - return theClass.getMethod(name, new JType[] { type }); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java deleted file mode 100644 index dcd22e47..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import javax.xml.namespace.QName; - -import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; -import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CCustomizations; -import com.sun.tools.xjc.model.CNonElement; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldOutline; - -/** - * Field utilities. - * - * @author valikov - */ -public class FieldUtils { - - /** Hidden constructor. */ - private FieldUtils() { - } - - // - // public static FieldItem[] getFieldItems(ClassContext classContext) { - // final List fieldItems = (List) classContext.target - // .visit(new FieldGatheringVisitor(classContext)); - // return (FieldItem[]) fieldItems.toArray(new - // FieldItem[fieldItems.size()]); - // } - // - // public static String getFieldName(ClassContext classContext, FieldItem - // fieldItem) { - // return ClassUtils.getClassName(classContext.target) + "." + - // fieldItem.name; - // } - // - // public static String getFieldPropertyName(FieldItem fieldItem) { - // return fieldItem.name; - // } - // - // public static String getCommonFieldPropertyName(FieldItem fieldItem) { - // final String draftName = fieldItem.name; - // return Introspector.decapitalize(draftName); - // } - // - // public static FieldItem getFieldItem(FieldUse fieldUse) { - // if (fieldUse.items.isEmpty()) { - // return null; - // } - // else { - // return (FieldItem) fieldUse.items.iterator().next(); - // } - // } - // - // public static FieldUse getFieldUse(ClassContext classContext, FieldItem - // fieldItem) { - // return classContext.target.getField(fieldItem.name); - // } - // - // /** - // * Returns a new unique name of the field in the given class, based on the - // given prefix. If required, the prefix will - // * be appended with an integer to make it unique - // * - // * @param theClass class to create field in. - // * @param prefix field name prefix. - // * @return Unique name of the new field. - // */ - // public static String generateUniqueFieldName(final JDefinedClass - // theClass, final String prefix) { - // final String name; - // if (null == getField(theClass, prefix)) { - // name = prefix; - // } - // else { - // int index = 0; - // while (null != getField(theClass, prefix + index)) { - // index++; - // } - // name = prefix + index; - // } - // return name; - // } - // - // /** - // * Retrievs a named field of the given class. - // * - // * @param theClass class to search a field in. - // * @param name name of the field. - // * @return Requested field of the given class. - // */ - // public static JVar getField(final JDefinedClass theClass, final String - // name) { - // JFieldVar result = null; - // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { - // final JFieldVar var = (JFieldVar) iterator.next(); - // if (name.equals(var.name())) { - // result = var; - // } - // } - // // todo : if not found??? - // return result; - // } - // - public static FieldOutline createAttributeField( - ClassOutlineImpl classOutline, String name, final QName attName, - final CNonElement typeInfo, final boolean required - // , - // final XSDatatype datatype, - // final JType type - ) { - - final CPropertyInfo propertyInfo = new CAttributePropertyInfo( - // name - name, - // source - null, new CCustomizations(), - // locator - null, - // attName - attName, - // typeUse - typeInfo, - // typeName - typeInfo.getTypeName(), - // required - required); - - propertyInfo.realization = new FieldRendererFactory().getDefault(); - final FieldOutline fieldOutline = - - propertyInfo.realization.generate(classOutline, propertyInfo); - - return fieldOutline; - - } - - // public static boolean isConstantField(ClassContext classContext, - // FieldItem fieldItem) { - // return AccessorUtils.get(classContext, fieldItem) == null; - // } - // - // public static FieldUse[] getFieldUses(final ClassItem classItem) { - // if (classItem.getSuperClass() == null) - // return classItem.getDeclaredFieldUses(); - // else { - // final FieldUse[] superFieldUses = - // FieldUtils.getFieldUses(classItem.getSuperClass()); - // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); - // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + - // declaredFieldUses.length]; - // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); - // System.arraycopy( - // declaredFieldUses, - // 0, - // fieldUses, - // superFieldUses.length, - // declaredFieldUses.length); - // return fieldUses; - // } - // } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java deleted file mode 100644 index 5d15c4e9..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - - -import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.tools.xjc.outline.Outline; - -public class GeneratorContextUtils { - - private GeneratorContextUtils() { - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - Class theClass) { - - return generateContextPathAwareClass(outline, name, theClass == null ? null : outline - .getCodeModel() - .ref(theClass)); - } - - public static JDefinedClass generateContextPathAwareClass( - Outline outline, - String name, - JClass baseClass) { - - final String contextPath = OutlineUtils.getContextPath(outline); - - final JCodeModel codeModel = outline.getCodeModel(); - final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( - codeModel, - JMod.PUBLIC, - name); - - ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); - - if (baseClass != null) { - contextPathAwareClass._extends(baseClass); - } - - final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel - .ref(String.class), "getContextPath"); - getContextPath.body()._return(JExpr.lit(contextPath)); - return contextPathAwareClass; - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java deleted file mode 100644 index 0ac70d73..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import java.util.Iterator; - -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; -import com.sun.xml.bind.api.impl.NameConverter; - -public class OutlineUtils { - - private OutlineUtils() { - } - - public static String getClassName(ClassOutline classOutline) { - return CodeModelUtils.getPackagedClassName(classOutline.implClass); - } - - public static String getFieldName(FieldOutline fieldOutline) { - return getClassName(fieldOutline.parent()) + "." - + fieldOutline.getPropertyInfo().getName(true); - } - - public static String getPropertyName(FieldOutline fieldOutline) { - return NameConverter.standard.toVariableName(fieldOutline - .getPropertyInfo().getName(true)); - } - - public static String getContextPath(Outline context) { - final StringBuilder sb = new StringBuilder(); - - for (final Iterator packageOutlines = context - .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { - final PackageOutline packageOutline = packageOutlines.next(); - final String packageName = packageOutline._package().name(); - sb.append(packageName); - if (packageOutlines.hasNext()) - sb.append(':'); - } - return sb.toString(); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java deleted file mode 100644 index c65295d2..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.jvnet.jaxb2_commons.util; - -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JConditional; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JOp; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.outline.FieldAccessor; -import com.sun.tools.xjc.outline.FieldOutline; - -public class PropertyFieldAccessorFactory implements FieldAccessorFactory { - - public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); - - public PropertyFieldAccessorFactory() { - - } - - public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, - JExpression targetObject) { - return new PropertyFieldAccessor(fieldOutline, targetObject); - } - - private static class PropertyFieldAccessor implements FieldAccessorEx { - private static final JType[] ABSENT = new JType[0]; - private final FieldOutline fieldOutline; - private final JExpression targetObject; - private final JDefinedClass theClass; - private final JMethod isSetter; - private final JMethod unSetter; - private final JMethod getter; - private final JMethod setter; - private final JFieldVar constantField; - private FieldAccessor fieldAccessor; - private final JType type; - - public PropertyFieldAccessor(final FieldOutline fieldOutline, - JExpression targetObject) { - super(); - this.fieldOutline = fieldOutline; - this.targetObject = targetObject; - this.fieldAccessor = fieldOutline.create(targetObject); - final String publicName = fieldOutline.getPropertyInfo().getName( - true); - this.theClass = fieldOutline.parent().implClass; - final String setterName = "set" + publicName; - final JMethod getGetter = theClass.getMethod("get" + publicName, - ABSENT); - final JMethod isGetter = theClass.getMethod("is" + publicName, - ABSENT); - this.getter = getGetter != null ? getGetter - : (isGetter != null ? isGetter : null); - this.type = this.getter != null ? this.getter.type() : fieldOutline - .getRawType(); - - final JFieldVar field = theClass.fields().get(publicName); - this.constantField = field != null - && ((field.mods().getValue() & JMod.PUBLIC) != 0) - && ((field.mods().getValue() & JMod.STATIC) != 0) - && ((field.mods().getValue() & JMod.FINAL) != 0) ? field - : null; - // fieldOutline.getRawType(); - final JType rawType = fieldOutline.getRawType(); - final JMethod boxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.boxify() }); - final JMethod unboxifiedSetter = theClass.getMethod(setterName, - new JType[] { rawType.unboxify() }); - this.setter = boxifiedSetter != null ? boxifiedSetter - : unboxifiedSetter; - this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); - this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); - } - - public JType getType() { - return type; - } - - public boolean isVirtual() { - return constantField != null; - } - - public boolean isConstant() { - return constantField != null; - } - - public FieldOutline owner() { - return fieldOutline; - } - - public CPropertyInfo getPropertyInfo() { - return fieldOutline.getPropertyInfo(); - } - - public boolean isAlwaysSet() { - if (constantField != null) { - return true; - } else { - return JExpr.TRUE == fieldAccessor.hasSetValue(); - } - } - - public JExpression hasSetValue() { - if (constantField != null) { - return JExpr.TRUE; - } else if (isSetter != null) { - return targetObject.invoke(isSetter); - } else { - return fieldAccessor.hasSetValue(); - } - } - - public void unsetValues(JBlock body) { - if (constantField != null) { - - } else if (unSetter != null) { - body.invoke(targetObject, unSetter); - } else { - - fieldAccessor.unsetValues(body); - } - } - - public void fromRawValue(JBlock block, String uniqueName, - JExpression $var) { - if (constantField != null) { - - } else if (setter != null) { - block.invoke(targetObject, setter).arg($var); - } else { - unsetValues(block); - if (fieldOutline.getPropertyInfo().isCollection()) { - fieldAccessor.fromRawValue(block - ._if($var.ne(JExpr._null()))._then(), uniqueName, - $var); - } else { - fieldAccessor.fromRawValue(block, uniqueName, $var); - } - } - } - - public void toRawValue(JBlock block, JVar $var) { - if (constantField != null) { - block.assign($var, theClass.staticRef(this.constantField)); - } else if (type.isPrimitive() - || fieldOutline.getPropertyInfo().isCollection()) { - final JExpression defaultExpression; - if (type.isPrimitive()) { - if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { - defaultExpression = JExpr.FALSE; - } else if (type.fullName().equals( - type.owner().BYTE.fullName())) { - final byte value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().CHAR.fullName())) { - final char value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().DOUBLE.fullName())) { - final double value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().FLOAT.fullName())) { - final float value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().INT.fullName())) { - final int value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().LONG.fullName())) { - final long value = 0; - defaultExpression = JExpr.lit(value); - } else if (type.fullName().equals( - type.owner().SHORT.fullName())) { - final short value = 0; - defaultExpression = JExpr.lit(value); - } else { - throw new UnsupportedOperationException(); - } - - } else if (fieldOutline.getPropertyInfo().isCollection()) { - defaultExpression = JExpr._null(); - } else { - throw new UnsupportedOperationException(); - } - if (getter != null) { - if (isAlwaysSet()) { - block.assign($var, targetObject.invoke(getter)); - } else { - block.assign($var, JOp.cond(hasSetValue(), - targetObject.invoke(getter), defaultExpression)); - } - } else { - final JConditional _if = block._if(hasSetValue()); - fieldAccessor.toRawValue(_if._then(), $var); - _if._else().assign($var, defaultExpression); - } - } else { - if (getter != null) { - block.assign($var, targetObject.invoke(getter)); - } else { - fieldAccessor.toRawValue(block, $var); - } - } - } - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java deleted file mode 100644 index e241a868..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutlineGenerator { - - public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, - MClassInfo classInfo); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java deleted file mode 100644 index 60a47d14..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutlineGenerator { - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java deleted file mode 100644 index ed2d2f90..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutlineGenerator { - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java deleted file mode 100644 index 12fea64b..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutlineGenerator { - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java deleted file mode 100644 index bea635ba..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutlineGenerator { - - public MModelOutline generate(MModelInfo modelInfo); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java deleted file mode 100644 index 7d782f88..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MObjectFactoryOutlineGenerator { - - public MObjectFactoryOutline generate(MPackageOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java deleted file mode 100644 index 68a365e2..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPackageOutlineGenerator { - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java deleted file mode 100644 index 5b55d7a8..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java deleted file mode 100644 index 65fef9ea..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.artificial; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class WrapperPropertyOutlineGenerator implements - MPropertyOutlineGenerator { - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - return new CMPropertyOutline(classOutline, propertyInfo, - new MPropertyAccessorFactory() { - - public MPropertyAccessor createPropertyAccessor( - JExpression target) { - // TODO - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java deleted file mode 100644 index cb6e5928..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ClassOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMClassOutlineGenerator implements MClassOutlineGenerator { - - private final Outline outline; - - private final CClassInfo classInfo; - - public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { - Validate.notNull(outline); - Validate.notNull(classInfo); - this.outline = outline; - this.classInfo = classInfo; - } - - public MClassOutline generate(final MPackageOutline parent, - MModelInfo modelInfo, - MClassInfo classInfo) { - - ClassOutline co = outline.getClazz(this.classInfo); - - final MClassOutline superClassOutline; - if (classInfo.getBaseTypeInfo() != null) { - superClassOutline = classInfo - .getBaseTypeInfo() - .acceptClassTypeInfoVisitor( - new MClassTypeInfoVisitor() { - @Override - public MClassOutline visitClassInfo( - MClassInfo info) { - return parent.getParent().getClassOutline( - info); - } - - @Override - public MClassOutline visitClassRef( - MClassRef info) { - return null; - } - }); - } else { - superClassOutline = null; - } - - final CMClassOutline classOutline = new CMClassOutline( - parent.getParent(), parent, classInfo, superClassOutline, - co.ref, co.implClass, co.implRef); - - for (MPropertyInfo propertyInfo : classInfo - .getProperties()) { - if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { - final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo - .getOrigin()).createGenerator(outline); - final MPropertyOutline propertyOutline = generator.generate( - classOutline, modelInfo, propertyInfo); - if (propertyOutline != null) { - classOutline.addDeclaredPropertyOutline(propertyOutline); - } - } - } - return classOutline; - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java deleted file mode 100644 index 15e216be..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.ElementOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMElementOutlineGenerator implements MElementOutlineGenerator { - - private final Outline outline; - private final CElementInfo elementInfo; - - public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { - Validate.notNull(outline); - Validate.notNull(elementInfo); - this.outline = outline; - this.elementInfo = elementInfo; - } - - public MElementOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MElementInfo elementInfo) { - final ElementOutline elementOutline = outline - .getElement(this.elementInfo); - if (elementOutline != null) { - return new CMElementOutline(parent.getParent(), parent, - elementInfo, elementOutline.implClass); - } else { - return null; - } - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java deleted file mode 100644 index 8178879e..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumConstantOutline; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumConstantOutlineGenerator implements - MEnumConstantOutlineGenerator { - - private final Outline outline; - private final CEnumConstant enumConstant; - - public CMEnumConstantOutlineGenerator(Outline outline, - CEnumConstant enumConstant) { - Validate.notNull(outline); - Validate.notNull(enumConstant); - this.outline = outline; - this.enumConstant = enumConstant; - } - - public MEnumConstantOutline generate(MEnumOutline parent, - MModelInfo modelInfo, - MEnumConstantInfo enumConstantInfo) { - - final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); - - final EnumOutline enumOutline = outline.getEnum(eli); - - for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { - if (enumConstantOutline.target == enumConstant) { - return new CMEnumConstantOutline(parent, enumConstantInfo, - enumConstantOutline.constRef); - } - } - return null; - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java deleted file mode 100644 index 0e5b4ec1..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.EnumOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { - - private final Outline outline; - private final CEnumLeafInfo enumLeafInfo; - - public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { - Validate.notNull(outline); - Validate.notNull(enumLeafInfo); - this.outline = outline; - this.enumLeafInfo = enumLeafInfo; - } - - public MEnumOutline generate(MPackageOutline parent, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) { - final EnumOutline eo = outline.getEnum(this.enumLeafInfo); - - final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), - parent, enumLeafInfo, eo.clazz); - - for (MEnumConstantInfo enumConstantInfo : enumLeafInfo - .getConstants()) { - - if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { - final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo - .getOrigin()).createGenerator(outline); - final MEnumConstantOutline enumConstantOutline = generator - .generate(enumOutline, modelInfo, enumConstantInfo); - if (enumConstantOutline != null) { - enumOutline.addEnumConstantOutline(enumConstantOutline); - } - } - } - return enumOutline; - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java deleted file mode 100644 index bb384e2f..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class CMModelOutlineGenerator implements MModelOutlineGenerator { - - private final Outline outline; - private final Model model; - - public CMModelOutlineGenerator(Outline outline, Model model) { - Validate.notNull(outline); - Validate.notNull(model); - this.outline = outline; - this.model = model; - } - - public MModelOutline generate(MModelInfo modelInfo) { - - final CMModelOutline modelOutline = new CMModelOutline(modelInfo, - outline.getCodeModel()); - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generatePackageOutline(modelOutline, modelInfo, - classInfo.getPackageInfo()); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generatePackageOutline(modelOutline, modelInfo, - elementInfo.getPackageInfo()); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generatePackageOutline(modelOutline, modelInfo, - enumLeafInfo.getPackageInfo()); - } - - for (MClassInfo classInfo : modelInfo.getClassInfos()) { - generateClassOutline(modelOutline, modelInfo, classInfo); - } - - for (MElementInfo elementInfo : modelInfo - .getElementInfos()) { - generateElementOutline(modelOutline, modelInfo, elementInfo); - } - - for (MEnumLeafInfo enumLeafInfo : modelInfo - .getEnumLeafInfos()) { - generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); - } - - // TODO Auto-generated method stub - return modelOutline; - } - - private void generatePackageOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, MPackageInfo packageInfo) { - if (modelOutline.getPackageOutline(packageInfo) == null && - - packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { - final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo - .getOrigin()).createGenerator(outline); - final MPackageOutline packageOutline = generator.generate( - modelOutline, modelInfo, packageInfo); - modelOutline.addPackageOutline(packageOutline); - - } - } - - private void generateClassOutline(final CMModelOutline modelOutline, - final MModelInfo modelInfo, - MClassInfo classInfo) { - if (classInfo.getBaseTypeInfo() != null) { - classInfo.getBaseTypeInfo().acceptClassTypeInfoVisitor( - new MClassTypeInfoVisitor() { - @Override - public Void visitClassInfo( - MClassInfo info) { - generateClassOutline(modelOutline, modelInfo, info); - return null; - } - - @Override - public Void visitClassRef(MClassRef info) { - return null; - } - }); - } - - if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { - final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo - .getOrigin()).createGenerator(this.outline); - final MClassOutline classOutline = generator.generate( - modelOutline.getPackageOutline(classInfo.getPackageInfo()), - modelInfo, classInfo); - if (classOutline != null) { - modelOutline.addClassOutline(classOutline); - } - } - } - - private void generateElementOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MElementInfo elementInfo) - - { - if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { - final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo - .getOrigin()).createGenerator(outline); - final MElementOutline elementOutline = generator - .generate(modelOutline.getPackageOutline(elementInfo - .getPackageInfo()), modelInfo, elementInfo); - if (elementOutline != null) { - modelOutline.addElementOutline(elementOutline); - } - } - } - - private void generateEnumOutline(CMModelOutline modelOutline, - MModelInfo modelInfo, - MEnumLeafInfo enumLeafInfo) - - { - if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { - final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo - .getOrigin()).createGenerator(outline); - final MEnumOutline enumOutline = generator.generate(modelOutline - .getPackageOutline(enumLeafInfo.getPackageInfo()), - modelInfo, enumLeafInfo); - if (enumOutline != null) { - modelOutline.addEnumOutline(enumOutline); - } - } - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java deleted file mode 100644 index b045735f..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { - - private final Outline outline; - - private final JPackage packageInfo; - - public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { - Validate.notNull(outline); - Validate.notNull(packageInfo); - this.outline = outline; - this.packageInfo = packageInfo; - } - - public MPackageOutline generate(MModelOutline parent, - MModelInfo modelInfo, MPackageInfo packageInfo) { - final PackageOutline packageOutline = outline - .getPackageContext(this.packageInfo); - Validate.notNull(packageOutline); - return new CMPackageOutline(parent, packageInfo, packageOutline); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java deleted file mode 100644 index 344bc3f7..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.FieldOutline; -import com.sun.tools.xjc.outline.Outline; - -public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { - - private final Outline outline; - - private final CPropertyInfo propertyInfo; - - private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; - - public CMPropertyOutlineGenerator(Outline outline, - CPropertyInfo propertyInfo) { - Validate.notNull(outline); - Validate.notNull(propertyInfo); - this.outline = outline; - this.propertyInfo = propertyInfo; - } - - public MPropertyOutline generate(MClassOutline classOutline, - MModelInfo modelInfo, - MPropertyInfo propertyInfo) { - - final FieldOutline fieldOutline = outline.getField(this.propertyInfo); - - final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( - this.fieldAccessorFactory, fieldOutline); - return new CMPropertyOutline(classOutline, propertyInfo, - propertyAccessorFactory); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java deleted file mode 100644 index 7db7d809..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; - -public interface ClassOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java deleted file mode 100644 index 81086d59..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; - -public interface ElementOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java deleted file mode 100644 index 6002cdd8..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; - -public interface EnumConstantOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java deleted file mode 100644 index 8cf6effb..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; - -public interface EnumOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java deleted file mode 100644 index f5cc77bd..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; - -public interface ModelOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java deleted file mode 100644 index 2117f91a..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import com.sun.tools.xjc.outline.Outline; - -public interface OutlineGeneratorFactory { - - public G createGenerator(Outline outline); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java deleted file mode 100644 index 530ee652..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; - -public interface PackageOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java deleted file mode 100644 index 38f2c19e..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.generator.concrete; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; - -public interface PropertyOutlineGeneratorFactory extends - OutlineGeneratorFactory { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java deleted file mode 100644 index 656f8d82..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java +++ /dev/null @@ -1,394 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete; - -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMClassRef; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.model.CAttributePropertyInfo; -import com.sun.tools.xjc.model.CBuiltinLeafInfo; -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.CClassInfoParent; -import com.sun.tools.xjc.model.CClassInfoParent.Visitor; -import com.sun.tools.xjc.model.CClassRef; -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.CElementPropertyInfo; -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.CReferencePropertyInfo; -import com.sun.tools.xjc.model.CTypeInfo; -import com.sun.tools.xjc.model.CValuePropertyInfo; -import com.sun.tools.xjc.model.CWildcardTypeInfo; -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Aspect; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMInfoFactory - extends - CMInfoFactory { - - private final Map> classRefs = - - new IdentityHashMap>(); - - public XJCCMInfoFactory(Model model) { - super(model); - } - - protected NClass getClazz(CClassRef info) { - return info; - } - - protected NClass getClazz(final Class _clas) { - return new NClass() { - - @Override - public boolean isBoxedType() { - return false; - } - - @Override - public String fullName() { - return _clas.getName(); - } - - @Override - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(_clas); - } - - @Override - public boolean isAbstract() { - return false; - } - }; - } - - protected NClass getClazz(final String className) { - return new NClass() { - - @Override - public boolean isBoxedType() { - return false; - } - - @Override - public String fullName() { - return className; - } - - @Override - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(className); - } - - @Override - public boolean isAbstract() { - return false; - } - }; - } - - protected MClassRef createClassRef(Class _class) { - return new CMClassRef(getClazz(_class), - getPackage(_class), getContainer(_class), getLocalName(_class)); - } - - protected MClassRef getTypeInfo(CClassRef info) { - - MClassRef classInfo = classRefs.get(info); - - if (classInfo == null) { - - classInfo = createClassRef(info); - classRefs.put(info, classInfo); - } - return classInfo; - } - - protected MClassRef createClassRef(CClassRef info) { - return new CMClassRef(getClazz(info), getPackage(info), - getContainer(info), getLocalName(info)); - } - - @Override - protected MTypeInfo getTypeInfo(CTypeInfo typeInfo) { - if (typeInfo instanceof CClassRef) { - return getTypeInfo((CClassRef) typeInfo); - } else { - return super.getTypeInfo(typeInfo); - } - } - - @Override - protected MPackageInfo getPackage(CClassInfo info) { - return getPackage(info.parent()); - } - - protected MPackageInfo getPackage(CClassRef info) { - final String fullName = info.fullName(); - return getPackage(fullName); - } - - private MPackageInfo getPackage(final String fullName) { - try { - final Class _class = Class.forName(fullName); - return getPackage(_class); - } catch (ClassNotFoundException cnfex) { - final String packageName; - final int lastIndexOfDot = fullName.lastIndexOf('.'); - if (lastIndexOfDot != -1) { - packageName = fullName.substring(0, lastIndexOfDot); - } else { - packageName = ""; - } - return new CMPackageInfo(new CMPackageInfoOrigin(), packageName); - } - } - - private MPackageInfo getPackage(final Class _class) { - final Package _package = _class.getPackage(); - return new CMPackageInfo(new CMPackageInfoOrigin(), _package.getName()); - } - - @Override - protected MPackageInfo getPackage(CEnumLeafInfo info) { - return getPackage(info.parent); - } - - @Override - protected MPackageInfo getPackage(CElementInfo info) { - return getPackage(info.parent); - } - - @Override - protected MContainer getContainer(CClassInfo info) { - final CClassInfoParent parent = info.parent(); - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CElementInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - @Override - protected MContainer getContainer(CEnumLeafInfo info) { - final CClassInfoParent parent = info.parent; - return parent == null ? null : getContainer(parent); - } - - protected MContainer getContainer(CClassRef info) { - final String fullName = info.fullName(); - try { - final Class _class = Class.forName(fullName); - return getContainer(_class); - } catch (ClassNotFoundException cnfex) { - return getPackage(info); - } - } - - private MContainer getContainer(final Class _class) { - final Class enclosingClass = _class.getEnclosingClass(); - if (enclosingClass == null) { - return getPackage(_class); - } else { - return createClassRef(enclosingClass); - } - } - - private final Map packages = new HashMap(); - - private MContainer getContainer(CClassInfoParent parent) { - return parent.accept(new Visitor() { - - public MContainer onBean(CClassInfo bean) { - return getTypeInfo(bean); - } - - public MContainer onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MContainer onElement(CElementInfo element) { - return getElementInfo(element); - } - }); - } - - private MPackageInfo getPackage(CClassInfoParent parent) { - - return parent.accept(new Visitor() { - - public MPackageInfo onBean(CClassInfo bean) { - return getPackage(bean.parent()); - } - - public MPackageInfo onPackage(JPackage pkg) { - return getPackage(pkg); - } - - public MPackageInfo onElement(CElementInfo element) { - return getPackage(element.parent); - } - }); - - } - - @Override - protected MClassInfo getScope(CClassInfo info) { - return info.getScope() == null ? null : getTypeInfo(info.getScope()); - } - - @Override - protected String getLocalName(CClassInfo info) { - return info.shortName; - } - - protected String getLocalName(CClassRef info) { - final String fullName = info.fullName(); - try { - final Class _class = Class.forName(fullName); - return getLocalName(_class); - } catch (ClassNotFoundException cnfex) { - return getLocalName(fullName); - } - } - - private String getLocalName(final String fullName) { - final int lastIndexOfDollar = fullName.lastIndexOf('$'); - if (lastIndexOfDollar != -1) { - return fullName.substring(lastIndexOfDollar + 1); - } - final int lastIndexOfDot = fullName.lastIndexOf('.'); - if (lastIndexOfDot != -1) { - return fullName.substring(lastIndexOfDot + 1); - } - return fullName; - } - - private String getLocalName(final Class _class) { - return _class.getSimpleName(); - } - - @Override - protected String getLocalName(CEnumLeafInfo info) { - return info.shortName; - } - - @Override - protected String getLocalName(CElementInfo info) { - return info.shortName(); - } - - @Override - protected MModelInfoOrigin createModelInfoOrigin(Model info) { - return new XJCCMModelInfoOrigin(info); - } - - protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { - return new XJCCMPackageInfoOrigin(info); - } - - protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { - return new XJCCMClassInfoOrigin(info); - } - - @Override - protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { - return new XJCCMPropertyInfoOrigin(info); - } - - @Override - protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { - return new XJCCMElementInfoOrigin(info); - } - - @Override - protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { - return new XJCCMEnumLeafInfoOrigin(info); - } - - @Override - protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( - CEnumConstant info) { - return new XJCCMEnumConstantInfoOrigin(info); - } - - @Override - protected NType createListType(final NType elementType) { - - return new NClass() { - - public boolean isBoxedType() { - return false; - } - - public String fullName() { - return List.class.getName(); - } - - public JClass toType(Outline o, Aspect aspect) { - return o.getCodeModel().ref(List.class) - .narrow(elementType.toType(o, aspect).boxify()); - } - - public boolean isAbstract() { - return false; - } - }; - } - - private MPackageInfo getPackage(JPackage pkg) { - String packageName = pkg.name(); - MPackageInfo _package = packages.get(packageName); - if (_package == null) { - _package = new CMPackageInfo(createPackageInfoOrigin(pkg), - packageName); - packages.put(packageName, _package); - } - return _package; - } - - @Override - protected MClassTypeInfo createBaseTypeInfo(CClassInfo info) { - if (info.getBaseClass() != null) { - return getTypeInfo(info.getBaseClass()); - } else if (info.getRefBaseClass() != null) { - return getTypeInfo(info.getRefBaseClass()); - } else { - return null; - } - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java deleted file mode 100644 index 04ca3d3e..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.lang.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -import com.sun.tools.xjc.outline.Outline; - -public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, - PropertyOutlineGeneratorFactory { - - private final MPropertyOutlineGenerator generator; - - public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { - Validate.notNull(generator); - this.generator = generator; - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return generator; - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java deleted file mode 100644 index bf8d126d..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; - -public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java deleted file mode 100644 index c716262f..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; - -import com.sun.codemodel.JPackage; - -public interface PackageInfoOrigin extends MSourced { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java deleted file mode 100644 index fb9a74df..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; - -import com.sun.tools.xjc.model.CClassInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMClassInfoOrigin extends - CMClassInfoOrigin implements - ClassOutlineGeneratorFactory { - - public XJCCMClassInfoOrigin(CClassInfo source) { - super(source); - } - - public MClassOutlineGenerator createGenerator(Outline outline) { - return new CMClassOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java deleted file mode 100644 index f4871ea1..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; - -import com.sun.tools.xjc.model.CElementInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMElementInfoOrigin extends - CMElementInfoOrigin implements - ElementOutlineGeneratorFactory { - - public XJCCMElementInfoOrigin(CElementInfo source) { - super(source); - } - - public MElementOutlineGenerator createGenerator(Outline outline) { - return new CMElementOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java deleted file mode 100644 index 9d0c1cb0..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; - -import com.sun.tools.xjc.model.CEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumConstantInfoOrigin extends - CMEnumConstantInfoOrigin implements - EnumConstantOutlineGeneratorFactory { - - public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { - super(source); - } - - public MEnumConstantOutlineGenerator createGenerator(Outline outline) { - return new CMEnumConstantOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java deleted file mode 100644 index c1859929..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; - -import com.sun.tools.xjc.model.CEnumLeafInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMEnumLeafInfoOrigin extends - CMEnumLeafInfoOrigin implements - EnumOutlineGeneratorFactory { - - public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { - super(source); - } - - public MEnumOutlineGenerator createGenerator(Outline outline) { - return new CMEnumOutlineGenerator(outline, getSource()); - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java deleted file mode 100644 index 26492d99..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; - -import com.sun.tools.xjc.model.Model; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMModelInfoOrigin extends - CMModelInfoOrigin implements - ModelOutlineGeneratorFactory { - - public XJCCMModelInfoOrigin(Model source) { - super(source); - } - - public MModelOutlineGenerator createGenerator(Outline outline) { - return new CMModelOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java deleted file mode 100644 index 28ed69a4..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements - PackageInfoOrigin, PackageOutlineGeneratorFactory { - - private final JPackage source; - - public XJCCMPackageInfoOrigin(JPackage source) { - Validate.notNull(source); - this.source = source; - } - - public JPackage getSource() { - return source; - } - - public MPackageOutlineGenerator createGenerator(Outline outline) { - return new CMPackageOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java deleted file mode 100644 index aeb6239e..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; - -import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; -import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; -import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; - -import com.sun.tools.xjc.model.CPropertyInfo; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class XJCCMPropertyInfoOrigin extends - CMPropertyInfoOrigin implements - PropertyOutlineGeneratorFactory { - - public XJCCMPropertyInfoOrigin(CPropertyInfo source) { - super(source); - } - - public MPropertyOutlineGenerator createGenerator(Outline outline) { - return new CMPropertyOutlineGenerator(outline, getSource()); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java deleted file mode 100644 index 51ee09b5..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.outline.FieldAccessor; - -public interface FieldAccessorEx extends FieldAccessor { - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); - - public boolean isAlwaysSet(); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java deleted file mode 100644 index 2119e570..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MChildOutline { - - public MModelOutline getParent(); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java deleted file mode 100644 index d28ab5fa..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MClassOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public MClassOutline getSuperClassOutline(); - - public List getPropertyOutlines(); - - public List getDeclaredPropertyOutlines(); - - public JDefinedClass getReferenceCode(); - - public JDefinedClass getImplementationCode(); - - public JClass getImplementationReferenceCode(); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java deleted file mode 100644 index 6b2fd8e5..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MElementOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public JDefinedClass getCode(); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java deleted file mode 100644 index 1e8f8204..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumConstantOutline extends - MTargeted> { - - public MEnumOutline getEnumOutline(); - - public JEnumConstant getCode(); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java deleted file mode 100644 index a73e8473..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.List; - -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MEnumOutline extends MChildOutline, MPackagedOutline, - MTargeted> { - - public List getEnumConstantOutlines(); - - public JDefinedClass getCode(); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java deleted file mode 100644 index 93800d8a..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MModelOutline extends MTargeted> { - - public Collection getPackageOutlines(); - - public MPackageOutline getPackageOutline(MPackageInfo target); - - public Collection getElementOutlines(); - - public MElementOutline getElementOutline(MElementInfo target); - - public Collection getClassOutlines(); - - public MClassOutline getClassOutline(MClassInfo target); - - public Collection getEnumOutlines(); - - public MEnumOutline getEnumOutline(MEnumLeafInfo target); - - public JCodeModel getCode(); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java deleted file mode 100644 index 70da3cbc..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JDefinedClass; - -public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { - - public JDefinedClass getCode(); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java deleted file mode 100644 index 30d3dc7e..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import java.util.Collection; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.codemodel.JPackage; - -public interface MPackageOutline extends MChildOutline, MTargeted { - - public MPackageInfo getTarget(); - - public Collection getElementOutlines(); - - public Collection getClassOutlines(); - - public Collection getEnumOutlines(); - - public MObjectFactoryOutline getObjectFactoryOutline(); - - public JPackage getCode(); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java deleted file mode 100644 index 34a3da0a..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -public interface MPackagedOutline { - - public MPackageOutline getPackageOutline(); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java deleted file mode 100644 index 8e6725c6..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public interface MPropertyAccessor { - - public void get(JBlock block, JVar variable); - - public void set(JBlock block, String uniqueName, JExpression value); - - public void unset(JBlock body); - - public JExpression isSet(); - - public JType getType(); - - public boolean isConstant(); - - public boolean isVirtual(); -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java deleted file mode 100644 index 254af93d..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import com.sun.codemodel.JExpression; - -public interface MPropertyAccessorFactory { - - public MPropertyAccessor createPropertyAccessor(JExpression target); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java deleted file mode 100644 index 551e1f2d..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline; - -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; - -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public interface MPropertyOutline extends - MTargeted>, MPropertyAccessorFactory { - - public MClassOutline getClassOutline(); - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java deleted file mode 100644 index f0c59ae2..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -public class AbstractPropertyAccessorFactory { - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java deleted file mode 100644 index e977655d..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JClass; -import com.sun.codemodel.JCodeModel; -import com.sun.codemodel.JDefinedClass; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractPropertyOutline implements MPropertyOutline { - - protected final Outline outline; - - protected final MModelOutline modelOutline; - - protected final MClassOutline classOutline; - - protected final MPropertyInfo propertyInfo; - - protected final JCodeModel codeModel; - - protected final JDefinedClass referenceClass; - - protected final JDefinedClass implementationClass; - - protected final JClass implementationReferenceClass; - - protected final JType type; - - public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - Validate.notNull(outline); - Validate.notNull(classOutline); - Validate.notNull(target); - this.outline = outline; - this.modelOutline = classOutline.getParent(); - this.classOutline = classOutline; - this.propertyInfo = target; - this.codeModel = classOutline.getParent().getCode(); - - this.referenceClass = classOutline.getReferenceCode(); - this.implementationClass = classOutline.getImplementationCode(); - this.implementationReferenceClass = classOutline - .getImplementationReferenceCode(); - - this.type = generateType(); - } - - protected JType generateType() { - return this.propertyInfo - .acceptPropertyInfoVisitor(new PropertyTypeVisitor( - this.modelOutline)); - } - - protected void annotate(JAnnotatable annotatable) { - this.propertyInfo - .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( - annotatable)); - } - - // protected JType getType(final Aspect aspect) { - // - // final List types = new ArrayList(); - // - // propertyInfo - // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { - // public Void visitAnyAttributePropertyInfo( - // MAnyAttributePropertyInfo info) { - // - // switch (aspect) { - // case EXPOSED: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // - // default: - // types.add(codeModel.ref(Map.class).narrow(QName.class) - // .narrow(Object.class)); - // break; - // } - // - // return null; - // } - // - // @Override - // public Void visitAnyElementPropertyInfo( - // MAnyElementPropertyInfo info) { - // - // types - // // if - // // TODO Auto-generated method stub - // return super.visitAnyElementPropertyInfo(info); - // } - // }); - // - // final class TypeList extends ArrayList { - // private static final long serialVersionUID = 1L; - // - // void add(CTypeInfo t) { - // add(t.getType().toType(outline, Aspect.EXPOSED)); - // if (t instanceof CElementInfo) { - // // UGLY. element substitution is implemented in a way that - // // the derived elements are not assignable to base elements. - // // so when we compute the signature, we have to take derived - // // types - // // into account - // add(((CElementInfo) t).getSubstitutionMembers()); - // } - // } - // - // void add(Collection col) { - // for (CTypeInfo typeInfo : col) - // add(typeInfo); - // } - // } - // TypeList r = new TypeList(); - // r.add(prop.ref()); - // - // JType t; - // t = TypeUtil.getCommonBaseType(codeModel, r); - // - // // if item type is unboxable, convert t=Integer -> t=int - // // the in-memory data structure can't have primitives directly, - // // but this guarantees that items cannot legal hold null, - // // which helps us improve the boundary signature between our - // // data structure and user code - // if (prop.isUnboxable()) - // t = t.unboxify(); - // return t; - // } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return propertyInfo; - } - - protected abstract class PropertyAccessor implements MPropertyAccessor { - - protected final JExpression target; - - public PropertyAccessor(JExpression target) { - Validate.notNull(target); - this.target = target; - } - - public JType getType() { - return AbstractPropertyOutline.this.type; - } - - public boolean isConstant() { - return false; - } - - public boolean isVirtual() { - return false; - } - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java deleted file mode 100644 index 12a69a0b..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class AbstractSinglePropertyOutline extends - AbstractPropertyOutline { - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AbstractSinglePropertyOutline(Outline outline, - MClassOutline classOutline, MPropertyInfo target) { - super(outline, classOutline, target); - this.field = generateField(); - this.getter = generateGetter(); - this.setter = generateSetter(); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, - propertyInfo.getPrivateName()); - annotate(field); - return field; - - } - - protected abstract JMethod generateGetter(); - - protected abstract JMethod generateSetter(); - - protected String getGetterMethodName() { - return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" - : "get") + propertyInfo.getPublicName(); - } - - protected String getSetterMethodName() { - return "set" + propertyInfo.getPublicName(); - } - - protected abstract class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, - target.invoke(AbstractSinglePropertyOutline.this.getter)); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - block.invoke(target, AbstractSinglePropertyOutline.this.setter) - .arg(value); - } - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java deleted file mode 100644 index 033acf34..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlValue; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JAnnotationUse; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class AnnotatePropertyVisitor implements - MPropertyInfoVisitor { - - private final JAnnotatable annotatable; - - public AnnotatePropertyVisitor(final JAnnotatable annotatable) { - Validate.notNull(annotatable); - this.annotatable = annotatable; - } - - public Void visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - this.annotatable.annotate(XmlAnyAttribute.class); - return null; - } - - public Void visitValuePropertyInfo(MValuePropertyInfo info) { - this.annotatable.annotate(XmlValue.class); - return null; - } - - public Void visitAttributePropertyInfo( - MAttributePropertyInfo info) { - - JAnnotationUse annotation = this.annotatable - .annotate(XmlAttribute.class); - - final String name = info.getAttributeName().getLocalPart(); - final String namespace = info.getAttributeName().getNamespaceURI(); - - annotation.param("name", name); - - // generate namespace property? - if (!namespace.equals("")) { // assume attributeFormDefault == - // unqualified - annotation.param("namespace", namespace); - } - - // TODO - // if(info.isRequired()) { - // xaw.required(true); - // } - - return null; - } - - public Void visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public Void visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java deleted file mode 100644 index 52713fdf..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.namespace.QName; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; - -import com.sun.codemodel.JAnnotatable; -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class AnyAttributePropertyOutline extends AbstractPropertyOutline { - - protected final JType type; - - protected final JFieldVar field; - - protected final JMethod getter; - - protected final JMethod setter; - - public AnyAttributePropertyOutline(Outline outline, - MClassOutline classOutline, - MAnyAttributePropertyInfo target) { - super(outline, classOutline, target); - - this.type = generateType(); - - this.field = generateField(); - - this.getter = generateGetter(); - - this.setter = generateSetter(); - - annotate(this.field); - - } - - protected JType generateType() { - return codeModel.ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - protected JFieldVar generateField() { - final JFieldVar field = referenceClass.field( - JMod.PROTECTED, - type, - propertyInfo.getPrivateName(), - - JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) - .narrow(Object.class))); - return field; - } - - protected void annotate(JAnnotatable annotatable) { - annotatable.annotate(XmlAnyAttribute.class); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" - + propertyInfo.getPublicName()); - - getter.body()._return(JExpr._this().ref(this.field)); - return getter; - } - - protected JMethod generateSetter() { - JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, - "set" + propertyInfo.getPublicName()); - - JVar value = setter.param(type, "value"); - - setter.body().invoke(JExpr._this().ref(this.field), "clear"); - setter.body().invoke(JExpr._this().ref(this.field), "putAll") - .arg(value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - public void get(JBlock block, JVar variable) { - target.invoke(AnyAttributePropertyOutline.this.getter); - - } - - public void set(JBlock block, String uniqueName, JExpression value) { - target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); - } - - public void unset(JBlock body) { - target.invoke(AnyAttributePropertyOutline.this.getter).invoke( - "clear"); - } - - public JExpression isSet() { - return target.invoke(AnyAttributePropertyOutline.this.getter) - .invoke("isEmpty").not(); - } - - @Override - public JType getType() { - return AnyAttributePropertyOutline.this.type; - } - - @Override - public boolean isVirtual() { - return false; - } - - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java deleted file mode 100644 index 369c9768..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JFieldVar; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { - - protected final JExpression value; - - protected final JFieldVar field; - - public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target, final JExpression value) { - super(outline, classOutline, target); - Validate.notNull(value); - this.value = value; - this.field = generateField(); - } - - protected JExpression createValue() { - return value; - } - - protected JFieldVar generateField() { - // generate the constant - JExpression value = createValue(); - - JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC - | JMod.FINAL, type, propertyInfo.getPublicName(), value); - - annotate(field); - - return field; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - public class PropertyAccessor extends - AbstractPropertyOutline.PropertyAccessor { - - public PropertyAccessor(JExpression target) { - super(target); - } - - @Override - public boolean isConstant() { - return true; - } - - public void unset(JBlock body) { - } - - public void set(JBlock block, String uniqueName, JExpression value) { - } - - @Override - public boolean isVirtual() { - return false; - } - - public JExpression isSet() { - return JExpr.TRUE; - } - - public void get(JBlock block, JVar variable) { - block.assign(variable, ConstantPropertyOutline.this.referenceClass - .staticRef(ConstantPropertyOutline.this.field)); - } - - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java deleted file mode 100644 index d89918aa..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; -import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; - -import com.sun.codemodel.JType; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class PropertyTypeVisitor implements - MPropertyInfoVisitor { - - private final MModelOutline modelOutline; - - public PropertyTypeVisitor(MModelOutline modelOutline) { - Validate.notNull(modelOutline); - this.modelOutline = modelOutline; - } - - public JType visitAnyAttributePropertyInfo( - MAnyAttributePropertyInfo info) { - - return modelOutline.getCode().ref(Map.class).narrow(QName.class) - .narrow(Object.class); - } - - public JType visitElementPropertyInfo( - MElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementsPropertyInfo( - MElementsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAnyElementPropertyInfo( - MAnyElementPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitAttributePropertyInfo( - MAttributePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitValuePropertyInfo(MValuePropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefPropertyInfo( - MElementRefPropertyInfo info) { - throw new UnsupportedOperationException(); - } - - public JType visitElementRefsPropertyInfo( - MElementRefsPropertyInfo info) { - throw new UnsupportedOperationException(); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java deleted file mode 100644 index 61572a6c..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.artificial; - -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JMethod; -import com.sun.codemodel.JMod; -import com.sun.codemodel.JVar; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; -import com.sun.tools.xjc.outline.Outline; - -public class SinglePropertyOutline extends AbstractSinglePropertyOutline { - - public SinglePropertyOutline(Outline outline, MClassOutline classOutline, - MPropertyInfo target) { - super(outline, classOutline, target); - } - - protected JMethod generateGetter() { - final JMethod getter = referenceClass.method(JMod.PUBLIC, - type, getGetterMethodName()); - getter.body()._return(field); - return getter; - } - - protected JMethod generateSetter() { - final JMethod setter = referenceClass.method(JMod.PUBLIC, - codeModel.VOID, getSetterMethodName()); - final JVar value = setter.param(type, "value"); - setter.body().assign(JExpr._this().ref(field), value); - return setter; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return new PropertyAccessor(target); - } - - protected class PropertyAccessor extends - AbstractSinglePropertyOutline.PropertyAccessor { - public PropertyAccessor(JExpression target) { - super(target); - } - - public JExpression isSet() { - return field.ne(JExpr._null()); - } - - public void unset(JBlock body) { - body.assign(field, JExpr._null()); - - } - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java deleted file mode 100644 index 11444b09..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; - -import com.sun.codemodel.JClass; -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMClassOutline implements MClassOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MClassInfo target; - private final MClassOutline superClassOutline; - - private final JDefinedClass referenceCode; - private final JDefinedClass implementationCode; - private final JClass implementationReferenceCode; - - private final List declaredPropertyOutlines = new ArrayList(); - private final List _delcaredPropertyOutlines = Collections - .unmodifiableList(declaredPropertyOutlines); - - public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, - MClassInfo target, MClassOutline superClassOutline, - JDefinedClass referenceCode, JDefinedClass implementationCode, - JClass implementationReferenceCode) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(referenceCode); - Validate.notNull(implementationCode); - Validate.notNull(implementationReferenceCode); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.superClassOutline = superClassOutline; - this.referenceCode = referenceCode; - this.implementationCode = implementationCode; - this.implementationReferenceCode = implementationReferenceCode; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MClassInfo getTarget() { - return target; - } - - public MClassOutline getSuperClassOutline() { - return superClassOutline; - } - - public JDefinedClass getReferenceCode() { - return referenceCode; - } - - public JDefinedClass getImplementationCode() { - return implementationCode; - } - - public JClass getImplementationReferenceCode() { - return implementationReferenceCode; - } - - public List getPropertyOutlines() { - if (getSuperClassOutline() == null) { - return getDeclaredPropertyOutlines(); - } else { - final List propertyOutlines = new ArrayList(); - propertyOutlines.addAll(getSuperClassOutline() - .getPropertyOutlines()); - propertyOutlines.addAll(getDeclaredPropertyOutlines()); - return Collections.unmodifiableList(propertyOutlines); - } - } - - public List getDeclaredPropertyOutlines() { - return _delcaredPropertyOutlines; - } - - public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { - this.declaredPropertyOutlines.add(propertyOutline); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java deleted file mode 100644 index 96e82667..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMElementOutline implements MElementOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MElementInfo target; - private final JDefinedClass code; - - public CMElementOutline(MModelOutline parent, - MPackageOutline packageOutline, MElementInfo target, - JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MElementInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java deleted file mode 100644 index 85bd7b16..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; - -import com.sun.codemodel.JEnumConstant; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumConstantOutline implements MEnumConstantOutline { - - private final MEnumOutline enumOutline; - - private final MEnumConstantInfo target; - - private final JEnumConstant code; - - public CMEnumConstantOutline(MEnumOutline enumOutline, - MEnumConstantInfo target, JEnumConstant code) { - Validate.notNull(enumOutline); - Validate.notNull(target); - Validate.notNull(code); - this.enumOutline = enumOutline; - this.target = target; - this.code = code; - } - - public MEnumOutline getEnumOutline() { - return enumOutline; - } - - public MEnumConstantInfo getTarget() { - return target; - } - - public JEnumConstant getCode() { - return code; - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java deleted file mode 100644 index 67a576c1..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; - -import com.sun.codemodel.JDefinedClass; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMEnumOutline implements MEnumOutline { - - private final MModelOutline parent; - private final MPackageOutline packageOutline; - private final MEnumLeafInfo target; - private final JDefinedClass code; - - private final List enumConstantOutlines = new ArrayList(); - private final List _enumConstantOutlines = Collections - .unmodifiableList(enumConstantOutlines); - - public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, - MEnumLeafInfo target, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(target); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.target = target; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public MEnumLeafInfo getTarget() { - return target; - } - - public JDefinedClass getCode() { - return code; - } - - public List getEnumConstantOutlines() { - return _enumConstantOutlines; - } - - public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { - Validate.notNull(enumConstantOutline); - Validate.isTrue(enumConstantOutline.getEnumOutline() == this); - this.enumConstantOutlines.add(enumConstantOutline); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java deleted file mode 100644 index 41c9d885..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JCodeModel; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMModelOutline implements MModelOutline { - - private final MModelInfo target; - private final JCodeModel code; - - private final List packageOutlines = new ArrayList(); - private final List _packageOutlines = Collections - .unmodifiableList(packageOutlines); - private final Map packageOutlinesMap = new IdentityHashMap(); - private final List elementOutlines = new ArrayList(); - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); - private final List classOutlines = new ArrayList(); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); - private final List enumOutlines = new ArrayList(); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); - - public CMModelOutline(MModelInfo target, JCodeModel code) { - Validate.notNull(target); - Validate.notNull(code); - this.target = target; - this.code = code; - } - - public MModelInfo getTarget() { - return target; - } - - public JCodeModel getCode() { - return code; - } - - public Collection getPackageOutlines() { - return _packageOutlines; - } - - public MPackageOutline getPackageOutline(MPackageInfo target) { - return packageOutlinesMap.get(target); - } - - public void addPackageOutline(MPackageOutline packageOutline) { - Validate.notNull(packageOutline); - this.packageOutlines.add(packageOutline); - this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public MClassOutline getClassOutline(MClassInfo target) { - return classOutlinesMap.get(target); - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - this.classOutlines.add(classOutline); - this.classOutlinesMap.put(classOutline.getTarget(), classOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public MEnumOutline getEnumOutline(MEnumLeafInfo target) { - return enumOutlinesMap.get(target); - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - this.enumOutlines.add(enumOutline); - this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public MElementOutline getElementOutline(MElementInfo target) { - return elementOutlinesMap.get(target); - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - this.elementOutlines.add(elementOutline); - this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java deleted file mode 100644 index 74b7bd87..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; - -import com.sun.codemodel.JDefinedClass; - -public class CMObjectFactoryOutline implements MObjectFactoryOutline { - - private final MModelOutline parent; - - private final MPackageOutline packageOutline; - - private final JDefinedClass code; - - public CMObjectFactoryOutline(MModelOutline parent, - MPackageOutline packageOutline, JDefinedClass code) { - Validate.notNull(parent); - Validate.notNull(packageOutline); - Validate.notNull(code); - this.parent = parent; - this.packageOutline = packageOutline; - this.code = code; - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageOutline getPackageOutline() { - return packageOutline; - } - - public JDefinedClass getCode() { - return code; - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java deleted file mode 100644 index be5334e4..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; - -import com.sun.codemodel.JPackage; -import com.sun.tools.xjc.outline.PackageOutline; - -public class CMPackageOutline implements MPackageOutline { - - private final MModelOutline parent; - - private final MPackageInfo target; - - private final JPackage code; - - private final MObjectFactoryOutline objectFactoryOutline; - - private final List elementOutlines = new ArrayList(); - private final List classOutlines = new ArrayList(); - private final List enumOutlines = new ArrayList(); - - private final List _elementOutlines = Collections - .unmodifiableList(elementOutlines); - private final List _classOutlines = Collections - .unmodifiableList(classOutlines); - private final List _enumOutlines = Collections - .unmodifiableList(enumOutlines); - - public CMPackageOutline(MModelOutline parent, MPackageInfo target, - PackageOutline packageOutline) { - Validate.notNull(parent); - Validate.notNull(target); - this.parent = parent; - this.target = target; - this.code = packageOutline._package(); - this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, - packageOutline.objectFactory()); - } - - public MModelOutline getParent() { - return parent; - } - - public MPackageInfo getTarget() { - return target; - } - - public JPackage getCode() { - return code; - } - - public MObjectFactoryOutline getObjectFactoryOutline() { - return objectFactoryOutline; - } - - public Collection getClassOutlines() { - return _classOutlines; - } - - public void addClassOutline(MClassOutline classOutline) { - Validate.notNull(classOutline); - Validate.isTrue(classOutline.getPackageOutline() == this); - this.classOutlines.add(classOutline); - } - - public Collection getElementOutlines() { - return _elementOutlines; - } - - public void addElementOutline(MElementOutline elementOutline) { - Validate.notNull(elementOutline); - Validate.isTrue(elementOutline.getPackageOutline() == this); - this.elementOutlines.add(elementOutline); - } - - public Collection getEnumOutlines() { - return _enumOutlines; - } - - public void addEnumOutline(MEnumOutline enumOutline) { - Validate.notNull(enumOutline); - Validate.isTrue(enumOutline.getPackageOutline() == this); - this.enumOutlines.add(enumOutline); - } -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java deleted file mode 100644 index f4f9e307..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; - -import com.sun.codemodel.JBlock; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JType; -import com.sun.codemodel.JVar; - -public class CMPropertyAccessor implements MPropertyAccessor { - - private final FieldAccessorEx fieldAccessor; - - public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { - Validate.notNull(fieldAccessor); - this.fieldAccessor = fieldAccessor; - } - - public void get(JBlock block, JVar variable) { - fieldAccessor.toRawValue(block, variable); - } - - public void set(JBlock block, String uniqueName, JExpression value) { - fieldAccessor.fromRawValue(block, uniqueName, value); - } - - public void unset(JBlock body) { - fieldAccessor.unsetValues(body); - } - - public JExpression isSet() { - return fieldAccessor.hasSetValue(); - } - - public JType getType() { - return fieldAccessor.getType(); - } - - public boolean isConstant() { - return fieldAccessor.isConstant(); - } - - public boolean isVirtual() { - return fieldAccessor.isVirtual(); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java deleted file mode 100644 index c8b7f118..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.outline.FieldOutline; - -public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { - - private final FieldAccessorFactory fieldAccessorFactory; - private final FieldOutline fieldOutline; - - public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, - FieldOutline fieldOutline) { - Validate.notNull(fieldAccessorFactory); - Validate.notNull(fieldOutline); - this.fieldAccessorFactory = fieldAccessorFactory; - this.fieldOutline = fieldOutline; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - FieldAccessorEx fieldAccessor = fieldAccessorFactory - .createFieldAccessor(fieldOutline, target); - return new CMPropertyAccessor(fieldAccessor); - } - -} diff --git a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java deleted file mode 100644 index 91362018..00000000 --- a/basics/trunk/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jvnet.jaxb2_commons.xjc.outline.concrete; - -import org.apache.commons.lang3.Validate; -import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; -import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; - -import com.sun.codemodel.JExpression; -import com.sun.tools.xjc.model.nav.NClass; -import com.sun.tools.xjc.model.nav.NType; - -public class CMPropertyOutline implements MPropertyOutline { - - private final MClassOutline classOutline; - - private final MPropertyInfo target; - - private final MPropertyAccessorFactory propertyAccessorFactory; - - public CMPropertyOutline(MClassOutline classOutline, - MPropertyInfo target, - MPropertyAccessorFactory propertyAccessorFactory) { - Validate.notNull(classOutline); - Validate.notNull(target); - Validate.notNull(propertyAccessorFactory); - this.classOutline = classOutline; - this.target = target; - this.propertyAccessorFactory = propertyAccessorFactory; - } - - public MClassOutline getClassOutline() { - return classOutline; - } - - public MPropertyInfo getTarget() { - return target; - } - - public MPropertyAccessor createPropertyAccessor(JExpression target) { - return this.propertyAccessorFactory.createPropertyAccessor(target); - } - -} diff --git a/build-1.6.bat b/build-1.6.bat new file mode 100644 index 00000000..27d512c9 --- /dev/null +++ b/build-1.6.bat @@ -0,0 +1,4 @@ +setlocal +set JAVA_HOME=%JAVA6_HOME% +call mvn clean install >std 2>err +endlocal \ No newline at end of file diff --git a/basics/tags/0.6.1/deploy.bat b/deploy.bat similarity index 100% rename from basics/tags/0.6.1/deploy.bat rename to deploy.bat diff --git a/basics/trunk/dist/pom.xml b/dist/pom.xml similarity index 100% rename from basics/trunk/dist/pom.xml rename to dist/pom.xml diff --git a/dist/src/main/assembly/dist-with-dependencies.xml b/dist/src/main/assembly/dist-with-dependencies.xml new file mode 100644 index 00000000..f6335e8c --- /dev/null +++ b/dist/src/main/assembly/dist-with-dependencies.xml @@ -0,0 +1,33 @@ + + dist-with-dependencies + + zip + + + + + README* + LICENSE* + NOTICE* + + + + + + dist + + false + + org.jvnet.jaxb2_commons:* + + + + lib + + false + + org.jvnet.jaxb2_commons:* + + + + diff --git a/dist/src/main/assembly/dist.xml b/dist/src/main/assembly/dist.xml new file mode 100644 index 00000000..d7d1c40c --- /dev/null +++ b/dist/src/main/assembly/dist.xml @@ -0,0 +1,25 @@ + + dist + + zip + + + + + README* + LICENSE* + NOTICE* + + + + + + dist + + false + + org.jvnet.jaxb2_commons:* + + + + diff --git a/install-1.6.bat b/install-1.6.bat new file mode 100644 index 00000000..b8fb9455 --- /dev/null +++ b/install-1.6.bat @@ -0,0 +1,4 @@ +setlocal +set JAVA_HOME=%JAVA6_HOME% +call mvn -X -DperformRelease -Psamples,tests,dist clean install >std 2>err +endlocal \ No newline at end of file diff --git a/basics/tags/0.6.1/install.bat b/install.bat similarity index 100% rename from basics/tags/0.6.1/install.bat rename to install.bat diff --git a/basics/tags/0.6.4/jaxb/pom.xml b/jaxb/pom.xml similarity index 100% rename from basics/tags/0.6.4/jaxb/pom.xml rename to jaxb/pom.xml diff --git a/basics/tags/0.6.2/jaxb/release.bat b/jaxb/release.bat similarity index 100% rename from basics/tags/0.6.2/jaxb/release.bat rename to jaxb/release.bat diff --git a/basics/tags/0.6.4/jaxb/xjc/pom.xml b/jaxb/xjc/pom.xml similarity index 100% rename from basics/tags/0.6.4/jaxb/xjc/pom.xml rename to jaxb/xjc/pom.xml diff --git a/basics/trunk/pom.xml b/pom.xml similarity index 100% rename from basics/trunk/pom.xml rename to pom.xml diff --git a/qrelease.bat b/qrelease.bat new file mode 100644 index 00000000..c82a5d74 --- /dev/null +++ b/qrelease.bat @@ -0,0 +1,76 @@ +setlocal +echo Setting JAVA_HOME to %JAVA6_HOME%. +set JAVA_HOME=%JAVA6_HOME% + +echo Performing a short clean build. +rem pause +call mvn clean install -DperformRelease +echo Short clean build completed. +rem pause + +echo Performing a full clean build. +rem pause +call mvn clean install -DperformRelease -Psamples,tests,dist +echo Full clean build completed. +rem pause + +echo Setting new version to %1. +rem pause +call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 +echo Version was set to %1. +rem pause +call mvn versions:commit -Psamples,tests,dist +echo Version %1 committed. +rem pause + +echo Performing a short clean build. +rem pause +call mvn clean install -DperformRelease +echo Short clean build completed. +rem pause + +echo Performing a full clean build. +rem pause +call mvn clean install -Psamples,tests,dist -DperformRelease +echo Full clean build completed. +rem pause + +echo Checking in version %1. +rem pause +call mvn scm:checkin -Dmessage="Version %1" +echo Version %1 was checked in. +rem pause + +echo Tagging version %1. +rem pause +call mvn scm:tag -Dtag=%1 +echo Version %1 was tagged. +rem pause + +echo Performing full clean deploy. +rem pause +call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy +echo Full clean deploy done. +rem pause + +echo Setting new version to %2. +rem pause +call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 +echo Version was set to %2. +rem pause +call mvn versions:commit -Psamples,tests,dist +echo Version %2 was committed. +rem pause + +echo Performing a short clean build. +rem pause +call mvn clean install -DperformRelease +rem pause + +echo Checking in version %2. +rem pause +call mvn scm:checkin -Dmessage="Version %2" +echo Version %2 was checked in. +rem pause + +endlocal \ No newline at end of file diff --git a/release.bat b/release.bat new file mode 100644 index 00000000..245c602b --- /dev/null +++ b/release.bat @@ -0,0 +1,76 @@ +setlocal +echo Setting JAVA_HOME to %JAVA6_HOME%. +set JAVA_HOME=%JAVA6_HOME% + +echo Performing a short clean build. +pause +call mvn clean install -DperformRelease +echo Short clean build completed. +pause + +echo Performing a full clean build. +pause +call mvn clean install -DperformRelease -Psamples,tests,dist +echo Full clean build completed. +pause + +echo Setting new version to %1. +pause +call mvn versions:set -Psamples,tests,dist -DnewVersion=%1 +echo Version was set to %1. +pause +call mvn versions:commit -Psamples,tests,dist +echo Version %1 committed. +pause + +echo Performing a short clean build. +pause +call mvn clean install -DperformRelease +echo Short clean build completed. +pause + +echo Performing a full clean build. +pause +call mvn clean install -Psamples,tests,dist -DperformRelease +echo Full clean build completed. +pause + +echo Checking in version %1. +pause +call mvn scm:checkin -Dmessage="Version %1" +echo Version %1 was checked in. +pause + +echo Tagging version %1. +pause +call mvn scm:tag -Dtag=%1 +echo Version %1 was tagged. +pause + +echo Performing full clean deploy. +pause +call mvn -DperformRelease -Psonatype-oss-release,samples,tests,dist clean deploy +echo Full clean deploy done. +pause + +echo Setting new version to %2. +pause +call mvn versions:set -Psamples,tests,dist -DnewVersion=%2 +echo Version was set to %2. +pause +call mvn versions:commit -Psamples,tests,dist +echo Version %2 was committed. +pause + +echo Performing a short clean build. +pause +call mvn clean install -DperformRelease +pause + +echo Checking in version %2. +pause +call mvn scm:checkin -Dmessage="Version %2" +echo Version %2 was checked in. +pause + +endlocal \ No newline at end of file diff --git a/runtime/.classpath b/runtime/.classpath new file mode 100644 index 00000000..ecf83840 --- /dev/null +++ b/runtime/.classpath @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/basics/tags/0.8.0/runtime/.project b/runtime/.project similarity index 100% rename from basics/tags/0.8.0/runtime/.project rename to runtime/.project diff --git a/basics/trunk/runtime/pom.xml b/runtime/pom.xml similarity index 100% rename from basics/trunk/runtime/pom.xml rename to runtime/pom.xml diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java new file mode 100644 index 00000000..20e638de --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/i18n/Reportable.java @@ -0,0 +1,40 @@ +package org.jvnet.jaxb2_commons.i18n; + +import java.util.ResourceBundle; + +/** + * Reportable object. + * + * @author Aleksei Valikov + */ +public interface Reportable +{ + /** + * Returns message code. This code will be used to locate message resource. + * + * @return String code that uniquely identifies this problem. May be used to reference messages. + */ + public String getMessageCode(); + + /** + * Returns parameters used to format the message. + * + * @return Array of parameters used to format problem message. + */ + public abstract Object[] getMessageParameters(); + + /** + * Formats the message using given resource bundle. + * + * @param bundle bundle to use resources from. + * @return Formatted message. + */ + public String getMessage(final ResourceBundle bundle); + + /** + * Returns the message. + * + * @return The message. + */ + public String getMessage(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java new file mode 100644 index 00000000..8fd37524 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ClassUtils.java @@ -0,0 +1,63 @@ +package org.jvnet.jaxb2_commons.lang; + +public class ClassUtils { + + private ClassUtils() { + } + + public static final char PACKAGE_SEPARATOR_CHAR = '.'; + + public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; + + /** + *

+ * Gets the class name minus the package name from a Class. + *

+ * + * @param cls + * the class to get the short name for. + * @return the class name without the package name or an empty string + */ + @SuppressWarnings("unchecked") + public static String getShortClassName(Class cls) { + if (cls == null) { + return ""; + } + return getShortClassName(cls.getName()); + } + + /** + *

+ * Gets the class name minus the package name from a String. + *

+ * + *

+ * The string passed in is assumed to be a class name - it is not checked. + *

+ * + * @param className + * the className to get the short name for + * @return the class name of the class without the package name or an empty + * string + */ + public static String getShortClassName(String className) { + if (className == null) { + return ""; + } + if (className.length() == 0) { + return ""; + } + char[] chars = className.toCharArray(); + int lastDot = 0; + for (int i = 0; i < chars.length; i++) { + if (chars[i] == PACKAGE_SEPARATOR_CHAR) { + lastDot = i + 1; + } else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner + // classes + chars[i] = PACKAGE_SEPARATOR_CHAR; + } + } + return new String(chars, lastDot, chars.length - lastDot); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java new file mode 100644 index 00000000..2b44d8ac --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ContextUtils.java @@ -0,0 +1,40 @@ +package org.jvnet.jaxb2_commons.lang; + +import java.io.StringWriter; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; + +public class ContextUtils { + + public static String getContextPath(Class... classes) { + if (classes == null) { + throw new IllegalArgumentException("The validated object is null"); + } + for (int i = 0; i < classes.length; i++) { + if (classes[i] == null) { + throw new IllegalArgumentException("The validated array contains null element at index: " + i); + } + } + + final StringBuilder contextPath = new StringBuilder(); + + for (int index = 0; index < classes.length; index++) { + if (index > 0) { + contextPath.append(':'); + } + contextPath.append(classes[index].getPackage().getName()); + } + return contextPath.toString(); + } + + public static String toString(JAXBContext context, Object object) + throws JAXBException { + final Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + final StringWriter sw = new StringWriter(); + marshaller.marshal(object, sw); + return sw.toString(); + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java new file mode 100644 index 00000000..5128900b --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyStrategy.java @@ -0,0 +1,43 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface CopyStrategy { + + public boolean copy(ObjectLocator locator, boolean value); + + public byte copy(ObjectLocator locator, byte value); + + public char copy(ObjectLocator locator, char value); + + public double copy(ObjectLocator locator, double value); + + public float copy(ObjectLocator locator, float value); + + public int copy(ObjectLocator locator, int value); + + public long copy(ObjectLocator locator, long value); + + public short copy(ObjectLocator locator, short value); + + public Object copy(ObjectLocator locator, Object value); + + public boolean[] copy(ObjectLocator locator, boolean[] value); + + public byte[] copy(ObjectLocator locator, byte[] value); + + public char[] copy(ObjectLocator locator, char[] value); + + public double[] copy(ObjectLocator locator, double[] value); + + public float[] copy(ObjectLocator locator, float[] value); + + public int[] copy(ObjectLocator locator, int[] value); + + public long[] copy(ObjectLocator locator, long[] value); + + public short[] copy(ObjectLocator locator, short[] value); + + public Object[] copy(ObjectLocator locator, Object[] value); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java new file mode 100644 index 00000000..12215e6f --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/CopyTo.java @@ -0,0 +1,14 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface CopyTo { + + public Object createNewInstance(); + + public Object copyTo(Object target); + + public Object copyTo(ObjectLocator locator, Object target, + CopyStrategy copyStrategy); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java new file mode 100644 index 00000000..96a4a61a --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultCopyStrategy.java @@ -0,0 +1,268 @@ +package org.jvnet.jaxb2_commons.lang; + +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class DefaultCopyStrategy implements CopyStrategy { + + protected Object copyInternal(ObjectLocator locator, Object object) { + if (object == null) { + return null; + } else if (object instanceof String) { + return object; + } else if (object instanceof Number) { + return object; + } else if (object instanceof CopyTo) { + return ((CopyTo) object).copyTo(locator, + ((CopyTo) object).createNewInstance(), this); + } else if (object instanceof Cloneable) { + return copyInternal(locator, (Cloneable) object); + } else { + return object; + } + } + + public Object copy(ObjectLocator locator, Object value) { + if (value == null) { + return null; + } + Class lhsClass = value.getClass(); + if (!lhsClass.isArray()) { + return copyInternal(locator, value); + } + // 'Switch' on type of array, to dispatch to the correct handler + // This handles multi dimensional arrays of the same depth + else if (value instanceof long[]) { + return copy(locator, (long[]) value); + } else if (value instanceof int[]) { + return copy(locator, (int[]) value); + } else if (value instanceof short[]) { + return copy(locator, (short[]) value); + } else if (value instanceof char[]) { + return copy(locator, (char[]) value); + } else if (value instanceof byte[]) { + return copy(locator, (byte[]) value); + } else if (value instanceof double[]) { + return copy(locator, (double[]) value); + } else if (value instanceof float[]) { + return copy(locator, (float[]) value); + } else if (value instanceof boolean[]) { + return copy(locator, (boolean[]) value); + } else { + // Not an array of primitives + return copy(locator, (Object[]) value); + } + } + + public long copy(ObjectLocator locator, long value) { + return value; + } + + public int copy(ObjectLocator locator, int value) { + return value; + } + + public short copy(ObjectLocator locator, short value) { + return value; + } + + public char copy(ObjectLocator locator, char value) { + return value; + } + + public byte copy(ObjectLocator locator, byte value) { + return value; + } + + public double copy(ObjectLocator locator, double value) { + return value; + } + + public float copy(ObjectLocator locator, float value) { + return value; + } + + public boolean copy(ObjectLocator locator, boolean value) { + return value; + } + + public Object[] copy(ObjectLocator locator, Object[] array) { + if (array == null) { + return null; + } + final Object[] copy = new Object[array.length]; + for (int index = 0; index < array.length; index++) { + final Object element = array[index]; + final Object elementCopy = copy(item(locator, index, element), + element); + copy[index] = elementCopy; + } + return copy; + } + + public long[] copy(ObjectLocator locator, long[] array) { + if (array == null) { + return null; + } + final long[] copy = new long[array.length]; + for (int index = 0; index < array.length; index++) { + final long element = array[index]; + final long elementCopy = copy(item(locator, index, element), + element); + copy[index] = elementCopy; + } + return copy; + } + + public int[] copy(ObjectLocator locator, int[] array) { + if (array == null) { + return null; + } + final int[] copy = new int[array.length]; + for (int index = 0; index < array.length; index++) { + final int element = array[index]; + final int elementCopy = copy(item(locator, index, element), element); + copy[index] = elementCopy; + } + return copy; + } + + public short[] copy(ObjectLocator locator, short[] array) { + if (array == null) { + return null; + } + final short[] copy = new short[array.length]; + for (int index = 0; index < array.length; index++) { + final short element = array[index]; + final short elementCopy = copy(item(locator, index, element), + element); + copy[index] = elementCopy; + } + return copy; + } + + public char[] copy(ObjectLocator locator, char[] array) { + if (array == null) { + return null; + } + final char[] copy = new char[array.length]; + for (int index = 0; index < array.length; index++) { + final char element = array[index]; + final char elementCopy = copy(item(locator, index, element), + element); + copy[index] = elementCopy; + } + return copy; + } + + public byte[] copy(ObjectLocator locator, byte[] array) { + if (array == null) { + return null; + } + final byte[] copy = new byte[array.length]; + for (int index = 0; index < array.length; index++) { + final byte element = array[index]; + final byte elementCopy = copy(item(locator, index, element), + element); + copy[index] = elementCopy; + } + return copy; + } + + public double[] copy(ObjectLocator locator, double[] array) { + if (array == null) { + return null; + } + final double[] copy = new double[array.length]; + for (int index = 0; index < array.length; index++) { + final double element = array[index]; + final double elementCopy = copy(item(locator, index, element), + element); + copy[index] = elementCopy; + } + return copy; + } + + public float[] copy(ObjectLocator locator, float[] array) { + if (array == null) { + return null; + } + final float[] copy = new float[array.length]; + for (int index = 0; index < array.length; index++) { + final float element = array[index]; + final float elementCopy = copy(item(locator, index, element), + element); + copy[index] = elementCopy; + } + return copy; + } + + public boolean[] copy(ObjectLocator locator, boolean[] array) { + if (array == null) { + return null; + } + final boolean[] copy = new boolean[array.length]; + for (int index = 0; index < array.length; index++) { + final boolean element = array[index]; + final boolean elementCopy = copy(item(locator, index, element), + element); + copy[index] = elementCopy; + } + return copy; + } + + protected Object copyInternal(ObjectLocator locator, Cloneable object) { + Method method = null; + + try { + method = object.getClass().getMethod("clone", (Class[]) null); + } catch (NoSuchMethodException nsmex) { + method = null; + } + + if (method == null || !Modifier.isPublic(method.getModifiers())) { + + throw new UnsupportedOperationException( + "Could not clone object [" + object + "].", + new CloneNotSupportedException( + "Object class [" + + object.getClass() + + "] implements java.lang.Cloneable interface, " + + "but does not provide a public no-arg clone() method. " + + "By convention, classes that implement java.lang.Cloneable " + + "should override java.lang.Object.clone() method (which is protected) " + + "with a public method.")); + } + + final boolean wasAccessible = method.isAccessible(); + try { + if (!wasAccessible) { + try { + method.setAccessible(true); + } catch (SecurityException ignore) { + } + } + + return method.invoke(object, (Object[]) null); + } catch (Exception ex) { + throw new UnsupportedOperationException( + "Could not clone the object [" + + object + + "] as invocation of the clone() method has thrown an exception.", + ex); + } finally { + if (!wasAccessible) { + try { + method.setAccessible(false); + } catch (SecurityException ignore) { + } + } + } + } + + public static final CopyStrategy INSTANCE = new DefaultCopyStrategy(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java new file mode 100644 index 00000000..b206503d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultEqualsStrategy.java @@ -0,0 +1,371 @@ +package org.jvnet.jaxb2_commons.lang; + +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class DefaultEqualsStrategy implements EqualsStrategy { + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object lhs, Object rhs) { + + if (lhs == rhs) { + return true; + } + if (lhs == null || rhs == null) { + return false; + } + Class lhsClass = lhs.getClass(); + if (!lhsClass.isArray()) { + return equalsInternal(leftLocator, rightLocator, lhs, rhs); + } else if (lhs.getClass() != rhs.getClass()) { + // Here when we compare different dimensions, for example: a + // boolean[][] to a boolean[] + return false; + } + // 'Switch' on type of array, to dispatch to the correct handler + // This handles multi dimensional arrays of the same depth + else if (lhs instanceof long[]) { + return equals(leftLocator, rightLocator, (long[]) lhs, (long[]) rhs); + } else if (lhs instanceof int[]) { + return equals(leftLocator, rightLocator, (int[]) lhs, (int[]) rhs); + } else if (lhs instanceof short[]) { + return equals(leftLocator, rightLocator, (short[]) lhs, + (short[]) rhs); + } else if (lhs instanceof char[]) { + return equals(leftLocator, rightLocator, (char[]) lhs, (char[]) rhs); + } else if (lhs instanceof byte[]) { + return equals(leftLocator, rightLocator, (byte[]) lhs, (byte[]) rhs); + } else if (lhs instanceof double[]) { + return equals(leftLocator, rightLocator, (double[]) lhs, + (double[]) rhs); + } else if (lhs instanceof float[]) { + return equals(leftLocator, rightLocator, (float[]) lhs, + (float[]) rhs); + } else if (lhs instanceof boolean[]) { + return equals(leftLocator, rightLocator, (boolean[]) lhs, + (boolean[]) rhs); + } else if (lhs instanceof Equals[]) { + return equalsInternal(leftLocator, rightLocator, (Equals[]) lhs, + (Equals[]) rhs); + } else if (lhs instanceof Enum[]) { + return equalsInternal(leftLocator, rightLocator, (Enum[]) lhs, + (Enum[]) rhs); + } else { + // Not an array of primitives + return equals(leftLocator, rightLocator, (Object[]) lhs, + (Object[]) rhs); + } + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object lhs, Object rhs) { + if (lhs == rhs) { + return true; + } + if (lhs == null || rhs == null) { + return false; + } + if (lhs instanceof Equals) { + return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); + } else if (lhs instanceof Enum) { + return equalsInternal(leftLocator, rightLocator, (Enum) lhs, (Enum) rhs); + } else { + return lhs.equals(rhs); + } + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Enum lhs, Enum rhs) { + if (lhs == rhs) { + return true; + } + if (lhs == null || rhs == null) { + return false; + } + if (lhs instanceof Equals) { + return equalsInternal(leftLocator, rightLocator, (Equals) lhs, (Equals) rhs); + } else { + return lhs.equals(rhs); + } + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Equals lhs, Equals rhs) { + if (lhs == rhs) { + return true; + } + if (lhs == null || rhs == null) { + return false; + } + return lhs.equals(leftLocator, rightLocator, rhs, this); + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, boolean left, boolean right) { + return left == right; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, byte left, byte right) { + return left == right; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, char left, char right) { + return left == right; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, double left, double right) { + + return equals(leftLocator, rightLocator, Double.doubleToLongBits(left), + Double.doubleToLongBits(right)); + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, float left, float right) { + return equals(leftLocator, rightLocator, Float.floatToIntBits(left), + Float.floatToIntBits(right)); + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, long left, long right) { + return left == right; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, int left, int right) { + return left == right; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, short left, short right) { + return left == right; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object[] left, Object[] right) { + + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Equals[] left, Equals[] right) { + + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equalsInternal(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Enum[] left, Enum[] right) { + + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equalsInternal(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, boolean[] left, boolean[] right) { + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, byte[] left, byte[] right) { + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, char[] left, char[] right) { + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, double[] left, double[] right) { + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, float[] left, float[] right) { + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, long[] left, long[] right) { + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, int[] left, int[] right) { + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, short[] left, short[] right) { + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.length != right.length) { + return false; + } + for (int i = 0; i < left.length; ++i) { + if (!equals(item(leftLocator, i, left[i]), + item(rightLocator, i, right[i]), left[i], right[i])) { + return false; + } + } + return true; + } + + public static EqualsStrategy INSTANCE = new DefaultEqualsStrategy(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java new file mode 100644 index 00000000..1267d4c4 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultHashCodeStrategy.java @@ -0,0 +1,289 @@ +package org.jvnet.jaxb2_commons.lang; + +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class DefaultHashCodeStrategy implements HashCodeStrategy { + + private int iConstant; + + public DefaultHashCodeStrategy() { + this.iConstant = 37; + } + + public DefaultHashCodeStrategy(int multiplierNonZeroOddNumber) { + + if (multiplierNonZeroOddNumber == 0) { + throw new IllegalArgumentException( + "HashCodeStrategy requires a non zero multiplier."); + } + if (multiplierNonZeroOddNumber % 2 == 0) { + throw new IllegalArgumentException( + "HashCodeStrategy requires an odd multiplier."); + } + this.iConstant = multiplierNonZeroOddNumber; + } + + public int hashCode(ObjectLocator locator, int hashCode, Object object) { + if (object == null) { + return hashCode * iConstant; + } else { + if (object.getClass().isArray() == false) { + return hashCodeInternal(locator, hashCode, object); + } else { + // 'Switch' on type of array, to dispatch to the correct handler + // This handles multi dimensional arrays + if (object instanceof long[]) { + return hashCode(locator, hashCode, (long[]) object); + } else if (object instanceof int[]) { + return hashCode(locator, hashCode, (int[]) object); + } else if (object instanceof short[]) { + return hashCode(locator, hashCode, (short[]) object); + } else if (object instanceof char[]) { + return hashCode(locator, hashCode, (char[]) object); + } else if (object instanceof byte[]) { + return hashCode(locator, hashCode, (byte[]) object); + } else if (object instanceof double[]) { + return hashCode(locator, hashCode, (double[]) object); + } else if (object instanceof float[]) { + return hashCode(locator, hashCode, (float[]) object); + } else if (object instanceof boolean[]) { + return hashCode(locator, hashCode, (boolean[]) object); + } else if (object instanceof HashCode[]) { + return hashCodeInternal(locator, hashCode, (HashCode[]) object); + } else if (object instanceof Enum[]) { + return hashCodeInternal(locator, hashCode, (Enum[]) object); + } else { + // Not an array of primitives + return hashCode(locator, hashCode, (Object[]) object); + } + } + } + } + + protected int hashCodeInternal(ObjectLocator locator, int hashCode, + Object value) { + if (value == null) { + return hashCode * iConstant; + } else if (value instanceof HashCode) { + return hashCodeInternal(locator, hashCode, (HashCode) value); + } else if (value instanceof Enum) { + return hashCodeInternal(locator, hashCode, (Enum) value); + } else { + return hashCode * iConstant + value.hashCode(); + } + } + + protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum value) { + if (value == null) { + return hashCode * iConstant; + } else if (value instanceof HashCode) { + return hashCodeInternal(locator, hashCode, (HashCode) value); + } else { + return hashCode * iConstant + value.hashCode(); + } + } + + protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode object) { + if (object == null) { + return hashCode * iConstant; + } else { + return hashCode * iConstant + object.hashCode(locator, this); + } + } + + + public int hashCode(ObjectLocator locator, int hashCode, Object[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode * iConstant + 1; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + } + + protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode * iConstant + 1; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCodeInternal(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + } + + + protected int hashCodeInternal(ObjectLocator locator, int hashCode, HashCode[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode * iConstant + 1; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCodeInternal(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + } + + public int hashCode(ObjectLocator locator, int hashCode, boolean value) { + return hashCode * iConstant + (value ? 0 : 1); + + } + + public int hashCode(ObjectLocator locator, int hashCode, byte value) { + return hashCode * iConstant + value; + + } + + public int hashCode(ObjectLocator locator, int hashCode, char value) { + return hashCode * iConstant + value; + + } + + public int hashCode(ObjectLocator locator, int hashCode, double value) { + return hashCode(locator, hashCode, Double.doubleToLongBits(value)); + + } + + public int hashCode(ObjectLocator locator, int hashCode, float value) { + return hashCode(locator, hashCode, Float.floatToIntBits(value)); + } + + public int hashCode(ObjectLocator locator, int hashCode, int value) { + return hashCode * iConstant + value; + + } + + public int hashCode(ObjectLocator locator, int hashCode, long value) { + return hashCode * iConstant + ((int) (value ^ (value >> 32))); + + } + + public int hashCode(ObjectLocator locator, int hashCode, short value) { + return hashCode * iConstant + value; + + } + + public int hashCode(ObjectLocator locator, int hashCode, boolean[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + } + + public int hashCode(ObjectLocator locator, int hashCode, byte[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + + } + + public int hashCode(ObjectLocator locator, int hashCode, char[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + + } + + public int hashCode(ObjectLocator locator, int hashCode, double[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + + } + + public int hashCode(ObjectLocator locator, int hashCode, float[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + + } + + public int hashCode(ObjectLocator locator, int hashCode, int[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + + } + + public int hashCode(ObjectLocator locator, int hashCode, long[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + + } + + public int hashCode(ObjectLocator locator, int hashCode, short[] value) { + if (value == null) { + return hashCode * iConstant; + } else { + int currentHashCode = hashCode; + for (int i = 0; i < value.length; i++) { + currentHashCode = hashCode(item(locator, i, value[i]), + currentHashCode, value[i]); + } + return currentHashCode; + } + + } + + public static final HashCodeStrategy INSTANCE = new DefaultHashCodeStrategy(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java new file mode 100644 index 00000000..72a49594 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultMergeStrategy.java @@ -0,0 +1,251 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class DefaultMergeStrategy implements MergeStrategy { + + protected Object mergeInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object leftValue, Object rightValue) { + if (leftValue == null) { + return rightValue; + } else if (rightValue == null) { + return leftValue; + } else { + if (leftValue instanceof MergeFrom) { + final Object newInstance = ((MergeFrom) leftValue) + .createNewInstance(); + ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, + leftValue, rightValue, this); + return newInstance; + } else if (rightValue instanceof MergeFrom) { + final Object newInstance = ((MergeFrom) rightValue) + .createNewInstance(); + ((MergeFrom) newInstance).mergeFrom(leftLocator, rightLocator, + leftValue, rightValue, this); + return newInstance; + } else { + return leftValue; + } + } + + } + + public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + Object left, Object right) { + + if (left == null) { + return right; + } + if (right == null) { + return left; + } + Class lhsClass = left.getClass(); + if (!lhsClass.isArray()) { + return mergeInternal(leftLocator, rightLocator, left, right); + } else if (left.getClass() != right.getClass()) { + // Here when we compare different dimensions, for example: a + // boolean[][] to a boolean[] + return false; + } + // 'Switch' on type of array, to dispatch to the correct handler + // This handles multi dimensional arrays of the same depth + else if (left instanceof long[]) { + return merge(leftLocator, rightLocator, (long[]) left, + (long[]) right); + } else if (left instanceof int[]) { + return merge(leftLocator, rightLocator, (int[]) left, (int[]) right); + } else if (left instanceof short[]) { + return merge(leftLocator, rightLocator, (short[]) left, + (short[]) right); + } else if (left instanceof char[]) { + return merge(leftLocator, rightLocator, (char[]) left, + (char[]) right); + } else if (left instanceof byte[]) { + return merge(leftLocator, rightLocator, (byte[]) left, + (byte[]) right); + } else if (left instanceof double[]) { + return merge(leftLocator, rightLocator, (double[]) left, + (double[]) right); + } else if (left instanceof float[]) { + return merge(leftLocator, rightLocator, (float[]) left, + (float[]) right); + } else if (left instanceof boolean[]) { + return merge(leftLocator, rightLocator, (boolean[]) left, + (boolean[]) right); + } else { + // Not an array of primitives + return merge(leftLocator, rightLocator, (Object[]) left, + (Object[]) right); + } + } + + public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + long leftValue, long rightValue) { + return leftValue != 0 ? leftValue : rightValue; + } + + public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + int leftValue, int rightValue) { + return leftValue != 0 ? leftValue : rightValue; + } + + public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + short leftValue, short rightValue) { + return leftValue != 0 ? leftValue : rightValue; + } + + public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + char leftValue, char rightValue) { + return leftValue != 0 ? leftValue : rightValue; + } + + public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + byte leftValue, byte rightValue) { + return leftValue != 0 ? leftValue : rightValue; + } + + public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + double leftValue, double rightValue) { + return leftValue != 0 ? leftValue : rightValue; + } + + public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + float leftValue, float rightValue) { + return leftValue != 0 ? leftValue : rightValue; + } + + public boolean merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + boolean leftValue, boolean rightValue) { + return leftValue ? leftValue : rightValue; + } + + public Object[] merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object[] leftValue, Object[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + long[] leftValue, long[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + int[] leftValue, int[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public short[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + short[] leftValue, short[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + char[] leftValue, char[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + byte[] leftValue, byte[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public double[] merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, double[] leftValue, double[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public float[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + float[] leftValue, float[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public boolean[] merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, boolean[] leftValue, + boolean[] rightValue) { + if (leftValue != null) { + if (rightValue != null) { + return leftValue.length > 0 ? leftValue : rightValue; + + } else { + return leftValue; + } + } else { + return rightValue; + } + } + + public static final MergeStrategy INSTANCE = new DefaultMergeStrategy(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java new file mode 100644 index 00000000..4aea0bb7 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/DefaultToStringStrategy.java @@ -0,0 +1,920 @@ +package org.jvnet.jaxb2_commons.lang; + +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; + +import java.util.Collection; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class DefaultToStringStrategy implements ToStringStrategy { + + /** + * Whether to use the field names, the default is true. + */ + private boolean useFieldNames = true; + + /** + * Whether to use the class name, the default is true. + */ + private boolean useClassName = true; + + /** + * Whether to use short class names, the default is false. + */ + private boolean useShortClassName = false; + + /** + * Whether to use the identity hash code, the default is true. + */ + private boolean useIdentityHashCode = true; + + /** + * The content start '['. + */ + private String contentStart = "["; + + /** + * The content end ']'. + */ + private String contentEnd = "]"; + + /** + * The field name value separator '='. + */ + private String fieldNameValueSeparator = "="; + + /** + * Whether the field separator should be added before any other fields. + */ + private boolean fieldSeparatorAtStart = false; + + /** + * Whether the field separator should be added after any other fields. + */ + private boolean fieldSeparatorAtEnd = false; + + /** + * The field separator ','. + */ + private String fieldSeparator = ", "; + + /** + * The array start '{'. + */ + private String arrayStart = "{"; + + /** + * The array separator ','. + */ + private String arraySeparator = ","; + + /** + * The array end '}'. + */ + private String arrayEnd = "}"; + + /** + * The value to use when fullDetail is null, the default value + * is true. + */ + private boolean fullDetail = true; + + /** + * The null text '<null>'. + */ + private String nullText = ""; + + /** + * The summary size text start '. + */ + private String sizeStartText = "'>'. + */ + private String sizeEndText = ">"; + + public boolean isFullDetail() { + return fullDetail; + } + + public boolean isUseIdentityHashCode() { + return useIdentityHashCode; + } + + @SuppressWarnings("unchecked") + protected String getShortClassName(Class cls) { + return ClassUtils.getShortClassName(cls); + } + + /** + *

+ * Append to the toString the class name. + *

+ * + * @param buffer + * the StringBuilder to populate + * @param object + * the Object whose name to output + */ + protected void appendClassName(StringBuilder buffer, Object object) { + if (useClassName && object != null) { + if (useShortClassName) { + buffer.append(getShortClassName(object.getClass())); + } else { + buffer.append(object.getClass().getName()); + } + } + } + + /** + *

+ * Append the {@link System#identityHashCode(java.lang.Object)}. + *

+ * + * @param buffer + * the StringBuilder to populate + * @param object + * the Object whose id to output + */ + protected void appendIdentityHashCode(StringBuilder buffer, Object object) { + if (this.isUseIdentityHashCode() && object != null) { + buffer.append('@'); + buffer.append(Integer.toHexString(System.identityHashCode(object))); + } + } + + /** + *

+ * Append to the toString the content start. + *

+ * + * @param buffer + * the StringBuilder to populate + */ + protected void appendContentStart(StringBuilder buffer) { + buffer.append(contentStart); + } + + /** + *

+ * Append to the toString the content end. + *

+ * + * @param buffer + * the StringBuilder to populate + */ + protected void appendContentEnd(StringBuilder buffer) { + buffer.append(contentEnd); + } + + protected void appendArrayStart(StringBuilder buffer) { + buffer.append(arrayStart); + } + + protected void appendArrayEnd(StringBuilder buffer) { + buffer.append(arrayEnd); + } + + protected void appendArraySeparator(StringBuilder buffer) { + buffer.append(arraySeparator); + } + + /** + *

+ * Append to the toString an indicator for null. + *

+ * + *

+ * The default indicator is '<null>'. + *

+ * + * @param buffer + * the StringBuilder to populate + */ + protected void appendNullText(StringBuilder buffer) { + buffer.append(nullText); + } + + /** + *

+ * Append to the toString the field start. + *

+ * + * @param buffer + * the StringBuilder to populate + * @param propertyName + * the field name + */ + protected void appendFieldStart(ObjectLocator parentLocator, Object parent, + String fieldName, StringBuilder buffer) { + if (useFieldNames && fieldName != null) { + buffer.append(fieldName); + buffer.append(fieldNameValueSeparator); + } + } + + /** + *

+ * Append to the toString the field end. + *

+ * + * @param buffer + * the StringBuilder to populate + * @param propertyName + * the field name, typically not used as already appended + */ + protected void appendFieldEnd(ObjectLocator parentLocator, Object parent, + String fieldName, StringBuilder buffer) { + appendFieldSeparator(buffer); + } + + /** + *

+ * Append to the toString the field separator. + *

+ * + * @param buffer + * the StringBuilder to populate + */ + protected void appendFieldSeparator(StringBuilder buffer) { + buffer.append(fieldSeparator); + } + + /** + *

+ * Append to the toString a size summary. + *

+ * + *

+ * The size summary is used to summarize the contents of + * Collections, Maps and arrays. + *

+ * + *

+ * The output consists of a prefix, the passed in size and a suffix. + *

+ * + *

+ * The default format is '<size=n>'. + *

+ * + * @param buffer + * the StringBuilder to populate + * @param propertyName + * the field name, typically not used as already appended + * @param size + * the size to append + */ + protected void appendSummarySize(ObjectLocator locator, + StringBuilder buffer, int size) { + buffer.append(sizeStartText); + buffer.append(size); + buffer.append(sizeEndText); + } + + public StringBuilder appendStart(ObjectLocator parentLocator, + Object object, StringBuilder buffer) { + if (object != null) { + appendClassName(buffer, object); + appendIdentityHashCode(buffer, object); + appendContentStart(buffer); + if (fieldSeparatorAtStart) { + appendFieldSeparator(buffer); + } + } + return buffer; + } + + public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, + StringBuilder buffer) { + if (this.fieldSeparatorAtEnd == false) { + removeLastFieldSeparator(buffer); + } + appendContentEnd(buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, Object value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, boolean value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, byte value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, char value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, double value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, float value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, long value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, int value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, short value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, + Object[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + @SuppressWarnings("unchecked") + public StringBuilder append(ObjectLocator parentLocator, Object parent, + String fieldName, StringBuilder buffer, Collection value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, + boolean[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, byte[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, char[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, + double[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, float[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, long[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, int[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + public StringBuilder appendField(ObjectLocator parentLocator, + Object parent, String fieldName, StringBuilder buffer, short[] value) { + appendFieldStart(parentLocator, parent, fieldName, buffer); + append(property(parentLocator, fieldName, value), buffer, value); + appendFieldEnd(parentLocator, parent, fieldName, buffer); + return buffer; + } + + @SuppressWarnings("unchecked") + protected StringBuilder appendInternal(ObjectLocator locator, + StringBuilder buffer, Object value) { + if (value instanceof Collection) { + append(locator, buffer, (Collection) value); + } else if (value instanceof ToString) { + ((ToString) value).append(locator, buffer, this); + } else { + buffer.append(value.toString()); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + Object value) { + if (value == null) { + appendNullText(buffer); + } else { + Class theClass = value.getClass(); + if (!theClass.isArray()) { + appendInternal(locator, buffer, value); + } + // 'Switch' on type of array, to dispatch to the correct handler + // This handles multi dimensional arrays of the same depth + else if (value instanceof long[]) { + append(locator, buffer, (long[]) value); + } else if (value instanceof int[]) { + append(locator, buffer, (int[]) value); + } else if (value instanceof short[]) { + append(locator, buffer, (short[]) value); + } else if (value instanceof char[]) { + append(locator, buffer, (char[]) value); + } else if (value instanceof byte[]) { + append(locator, buffer, (byte[]) value); + } else if (value instanceof double[]) { + append(locator, buffer, (double[]) value); + } else if (value instanceof float[]) { + append(locator, buffer, (float[]) value); + } else if (value instanceof boolean[]) { + append(locator, buffer, (boolean[]) value); + } else { + // Not an array of primitives + append(locator, buffer, (Object[]) value); + } + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + boolean value) { + buffer.append(value); + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + byte value) { + buffer.append(value); + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + char value) { + buffer.append(value); + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + double value) { + buffer.append(value); + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + float value) { + buffer.append(value); + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + int value) { + buffer.append(value); + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + long value) { + buffer.append(value); + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + short value) { + buffer.append(value); + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + Object[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + @SuppressWarnings("unchecked") + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + Collection array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + boolean[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + byte[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + char[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + double[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + float[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + int[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + long[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + public StringBuilder append(ObjectLocator locator, StringBuilder buffer, + short[] array) { + if (array == null) { + appendNullText(buffer); + + } else if (isFullDetail()) { + appendDetail(locator, buffer, array); + + } else { + appendSummary(locator, buffer, array); + } + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, boolean[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, byte[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, char[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, double[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, float[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, int[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, long[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, short[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, Object[] array) { + appendSummarySize(locator, buffer, array.length); + return buffer; + } + + @SuppressWarnings("unchecked") + protected StringBuilder appendSummary(ObjectLocator locator, + StringBuilder buffer, Collection value) { + appendSummarySize(locator, buffer, value.size()); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, boolean[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + if (i > 0) { + buffer.append(arraySeparator); + } + append(item(locator, i, array[i]), buffer, array[i]); + } + buffer.append(arrayEnd); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, byte[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + if (i > 0) { + buffer.append(arraySeparator); + } + append(item(locator, i, array[i]), buffer, array[i]); + } + buffer.append(arrayEnd); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, char[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + if (i > 0) { + buffer.append(arraySeparator); + } + append(item(locator, i, array[i]), buffer, array[i]); + } + buffer.append(arrayEnd); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, double[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + if (i > 0) { + buffer.append(arraySeparator); + } + append(item(locator, i, array[i]), buffer, array[i]); + } + buffer.append(arrayEnd); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, float[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + if (i > 0) { + buffer.append(arraySeparator); + } + append(item(locator, i, array[i]), buffer, array[i]); + } + buffer.append(arrayEnd); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, int[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + if (i > 0) { + buffer.append(arraySeparator); + } + append(item(locator, i, array[i]), buffer, array[i]); + } + buffer.append(arrayEnd); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, long[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + if (i > 0) { + buffer.append(arraySeparator); + } + append(item(locator, i, array[i]), buffer, array[i]); + } + buffer.append(arrayEnd); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, short[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + if (i > 0) { + buffer.append(arraySeparator); + } + append(item(locator, i, array[i]), buffer, array[i]); + } + buffer.append(arrayEnd); + return buffer; + } + + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, Object[] array) { + buffer.append(arrayStart); + for (int i = 0; i < array.length; i++) { + Object item = array[i]; + if (i > 0) { + buffer.append(arraySeparator); + } + if (item == null) { + appendNullText(buffer); + + } else { + append(item(locator, i, array[i]), buffer, array[i]); + } + } + buffer.append(arrayEnd); + return buffer; + } + + @SuppressWarnings("unchecked") + protected StringBuilder appendDetail(ObjectLocator locator, + StringBuilder buffer, Collection array) { + appendArrayStart(buffer); + int i = 0; + for (Object item : array) { + if (i > 0) { + appendArraySeparator(buffer); + } + append(item(locator, i, item), buffer, item); + i = i + 1; + } + appendArrayEnd(buffer); + return buffer; + } + + /** + *

+ * Remove the last field separator from the buffer. + *

+ * + * @param buffer + * the StringBuilder to populate + * @since 2.0 + */ + protected void removeLastFieldSeparator(StringBuilder buffer) { + int len = buffer.length(); + int sepLen = fieldSeparator.length(); + if (len > 0 && sepLen > 0 && len >= sepLen) { + boolean match = true; + for (int i = 0; i < sepLen; i++) { + if (buffer.charAt(len - 1 - i) != fieldSeparator.charAt(sepLen + - 1 - i)) { + match = false; + break; + } + } + if (match) { + buffer.setLength(len - sepLen); + } + } + } + + public static final ToStringStrategy INSTANCE = new DefaultToStringStrategy(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java new file mode 100644 index 00000000..c29553a6 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EnumValue.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.lang; + +public interface EnumValue { + + public T enumValue(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java new file mode 100644 index 00000000..7991d62e --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Equals.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface Equals { + + public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, + Object that, EqualsStrategy equalsStrategy); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java new file mode 100644 index 00000000..1e6236e0 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/EqualsStrategy.java @@ -0,0 +1,61 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface EqualsStrategy { + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, boolean left, boolean right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, byte left, byte right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, char left, char right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, double left, double right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, float left, float right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, int left, int right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, long left, long right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, short left, short right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object left, Object right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, boolean[] left, boolean[] right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, byte[] left, byte[] right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, char[] left, char[] right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, double[] left, double[] right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, float[] left, float[] right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, int[] left, int[] right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, long[] left, long[] right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, short[] left, short[] right); + + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object[] left, Object[] right); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java new file mode 100644 index 00000000..4dbb3cae --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCode.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface HashCode { + + public int hashCode(ObjectLocator locator, HashCodeStrategy hashCodeStrategy); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java new file mode 100644 index 00000000..87918e05 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/HashCodeStrategy.java @@ -0,0 +1,26 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface HashCodeStrategy { + + public int hashCode(ObjectLocator locator, int hashCode, boolean value); + public int hashCode(ObjectLocator locator, int hashCode, byte value); + public int hashCode(ObjectLocator locator, int hashCode, char value); + public int hashCode(ObjectLocator locator, int hashCode, double value); + public int hashCode(ObjectLocator locator, int hashCode, float value); + public int hashCode(ObjectLocator locator, int hashCode, int value); + public int hashCode(ObjectLocator locator, int hashCode, long value); + public int hashCode(ObjectLocator locator, int hashCode, short value); + public int hashCode(ObjectLocator locator, int hashCode, Object value); + public int hashCode(ObjectLocator locator, int hashCode, boolean[] value); + public int hashCode(ObjectLocator locator, int hashCode, byte[] value); + public int hashCode(ObjectLocator locator, int hashCode, char[] value); + public int hashCode(ObjectLocator locator, int hashCode, double[] value); + public int hashCode(ObjectLocator locator, int hashCode, float[] value); + public int hashCode(ObjectLocator locator, int hashCode, int[] value); + public int hashCode(ObjectLocator locator, int hashCode, long[] value); + public int hashCode(ObjectLocator locator, int hashCode, short[] value); + public int hashCode(ObjectLocator locator, int hashCode, Object[] value); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java new file mode 100644 index 00000000..ab9a4529 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBCopyStrategy.java @@ -0,0 +1,63 @@ +package org.jvnet.jaxb2_commons.lang; + +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBElement; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.w3c.dom.Node; + +public class JAXBCopyStrategy extends DefaultCopyStrategy { + @SuppressWarnings("unchecked") + @Override + protected Object copyInternal(ObjectLocator locator, Object object) { + if (object instanceof Node) { + final Node node = (Node) object; + return copyInternal(locator, node); + } else if (object instanceof JAXBElement) { + final JAXBElement jaxbElement = (JAXBElement) object; + return copyInternal(locator, jaxbElement); + } else if (object instanceof List) { + List list = (List) object; + return copyInternal(locator, list); + + } else + + { + return super.copyInternal(locator, object); + } + } + + protected Object copyInternal(ObjectLocator locator, final Node node) { + return node.cloneNode(true); + } + + @SuppressWarnings("unchecked") + protected Object copyInternal(ObjectLocator locator, + final JAXBElement jaxbElement) { + final Object sourceObject = jaxbElement.getValue(); + final Object copyObject = copy(property(locator, "value", sourceObject), sourceObject); + final JAXBElement copyElement = new JAXBElement(jaxbElement.getName(), + jaxbElement.getDeclaredType(), jaxbElement.getScope(), + copyObject); + return copyElement; + } + + @SuppressWarnings("unchecked") + protected Object copyInternal(ObjectLocator locator, List list) { + final List copy = new ArrayList(list.size()); + for (int index = 0; index < list.size(); index++) { + final Object element = list.get(index); + final Object copyElement = copy(item(locator, index, element), element); + copy.add(copyElement); + } + return copy; + } + + public static final CopyStrategy INSTANCE = new JAXBCopyStrategy(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java new file mode 100644 index 00000000..5d0e8557 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBEqualsStrategy.java @@ -0,0 +1,65 @@ +package org.jvnet.jaxb2_commons.lang; + +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; + +import java.util.Iterator; +import java.util.List; + +import javax.xml.bind.JAXBElement; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class JAXBEqualsStrategy extends DefaultEqualsStrategy { + + @Override + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object lhs, Object rhs) { + if (lhs instanceof JAXBElement && rhs instanceof JAXBElement) { + final JAXBElement left = (JAXBElement) lhs; + final JAXBElement right = (JAXBElement) rhs; + return equalsInternal(leftLocator, rightLocator, left, right); + } else if (lhs instanceof List && rhs instanceof List) { + final List left = (List) lhs; + final List right = (List) rhs; + return equalsInternal(leftLocator, rightLocator, left, right); + } else { + return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); + + } + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, final List left, final List right) { + final Iterator e1 = left.iterator(); + final Iterator e2 = right.iterator(); + int index = 0; + while (e1.hasNext() && e2.hasNext()) { + Object o1 = e1.next(); + Object o2 = e2.next(); + if (!(o1 == null ? o2 == null : equals( + item(leftLocator, index, o1), item(rightLocator, index, + o2), o1, o2))) { + return false; + } + index = index + 1; + } + return !(e1.hasNext() || e2.hasNext()); + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, final JAXBElement left, + final JAXBElement right) { + return + // + equals(property(leftLocator, "name", left.getName()), property(rightLocator, + "name", right.getName()), left.getName(), right.getName()) + && + // + equals(property(leftLocator, "value", left.getValue()), property( + rightLocator, "name", right.getValue()), left + .getValue(), right.getValue()); + } + + public static EqualsStrategy INSTANCE = new JAXBEqualsStrategy(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java new file mode 100644 index 00000000..ed3671ce --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBHashCodeStrategy.java @@ -0,0 +1,71 @@ +package org.jvnet.jaxb2_commons.lang; + +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.item; +import static org.jvnet.jaxb2_commons.locator.util.LocatorUtils.property; + +import java.util.List; + +import javax.xml.bind.JAXBElement; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class JAXBHashCodeStrategy extends DefaultHashCodeStrategy { + + public JAXBHashCodeStrategy() { + super(); + } + + public JAXBHashCodeStrategy(int multiplierNonZeroOddNumber) { + super(multiplierNonZeroOddNumber); + } + + protected int hashCodeInternal(ObjectLocator locator, int hashCode, + Object value) { + if (value instanceof JAXBElement) { + final JAXBElement element = (JAXBElement) value; + return hashCodeInternal(locator, hashCode, element); + } else if (value instanceof List) { + final List list = (List) value; + return hashCodeInternal(locator, hashCode, list); + } else { + return super.hashCodeInternal(locator, hashCode, value); + } + } + + protected int hashCodeInternal(ObjectLocator locator, int hashCode, + final JAXBElement element) { + int currentHashCode = hashCode; + currentHashCode = hashCode( + property(locator, "name", element.getName()), currentHashCode, + element.getName()); + currentHashCode = hashCode( + property(locator, "declaredType", element.getDeclaredType()), + currentHashCode, element.getDeclaredType()); + currentHashCode = hashCode( + property(locator, "scope", element.getScope()), + currentHashCode, element.getScope()); + currentHashCode = hashCode( + property(locator, "value", element.getValue()), + currentHashCode, element.getValue()); + return currentHashCode; + } + + protected int hashCodeInternal(ObjectLocator locator, int hashCode, + final List list) { + // Treat empty lists as nulls + if (list.isEmpty()) { + return super.hashCode(locator, hashCode, (Object) null); + } else { + int currentHashCode = hashCode; + for (int index = 0; index < list.size(); index++) { + final Object item = list.get(index); + currentHashCode = hashCode(item(locator, index, item), + currentHashCode, item); + } + return currentHashCode; + } + } + + public static HashCodeStrategy INSTANCE = new JAXBHashCodeStrategy(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java new file mode 100644 index 00000000..d2f34ddb --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeCollectionsStrategy.java @@ -0,0 +1,39 @@ +package org.jvnet.jaxb2_commons.lang; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class JAXBMergeCollectionsStrategy extends JAXBMergeStrategy { + + @Override + protected Object mergeInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Collection leftCollection, + Collection rightCollection) { + + if (leftCollection instanceof List && rightCollection instanceof List) { + final List list = new ArrayList(leftCollection + .size() + + rightCollection.size()); + list.addAll(leftCollection); + list.addAll(rightCollection); + return list; + } else if (leftCollection instanceof Set + && rightCollection instanceof Set) { + final Set set = new HashSet(leftCollection.size() + + rightCollection.size()); + set.addAll(leftCollection); + set.addAll(rightCollection); + return set; + } else { + return super.mergeInternal(leftLocator, rightLocator, + leftCollection, rightCollection); + } + } + + public static final MergeStrategy INSTANCE = new JAXBMergeCollectionsStrategy(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java new file mode 100644 index 00000000..fd73edf7 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBMergeStrategy.java @@ -0,0 +1,32 @@ +package org.jvnet.jaxb2_commons.lang; + +import java.util.Collection; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class JAXBMergeStrategy extends DefaultMergeStrategy { + + @SuppressWarnings("unchecked") + @Override + protected Object mergeInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object left, Object right) { + if (left instanceof Collection && right instanceof Collection) { + Collection leftCollection = (Collection) left; + Collection rightCollection = (Collection) right; + return mergeInternal(leftLocator, rightLocator, leftCollection, + rightCollection); + } else { + return super.mergeInternal(leftLocator, rightLocator, left, right); + } + } + + @SuppressWarnings("unchecked") + protected Object mergeInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Collection leftCollection, + Collection rightCollection) { + return !leftCollection.isEmpty() ? leftCollection : rightCollection; + } + + public static final MergeStrategy INSTANCE = new JAXBMergeStrategy(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java new file mode 100644 index 00000000..869e8c9c --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/JAXBToStringStrategy.java @@ -0,0 +1,48 @@ +package org.jvnet.jaxb2_commons.lang; + +import javax.xml.bind.JAXBElement; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class JAXBToStringStrategy extends DefaultToStringStrategy { + + private String jaxbElementStart = "<"; + + private String jaxbElementEnd = ">"; + + protected void appendJAXBElementStart(StringBuilder stringBuilder) { + stringBuilder.append(jaxbElementStart); + } + + protected void appendJAXBElementEnd(StringBuilder stringBuilder) { + stringBuilder.append(jaxbElementEnd); + } + + @SuppressWarnings("unchecked") + @Override + protected StringBuilder appendInternal(ObjectLocator locator, + StringBuilder stringBuilder, Object value) { + if (value instanceof JAXBElement) { + final JAXBElement jaxbElement = (JAXBElement) value; + appendInternal(locator, stringBuilder, jaxbElement); + } else { + super.appendInternal(locator, stringBuilder, value); + } + return stringBuilder; + } + + @SuppressWarnings("unchecked") + protected StringBuilder appendInternal(ObjectLocator locator, + StringBuilder stringBuilder, JAXBElement value) { + appendJAXBElementStart(stringBuilder); + stringBuilder.append(value.getName()); + appendContentStart(stringBuilder); + append(locator, stringBuilder, value.getValue()); + appendContentEnd(stringBuilder); + appendJAXBElementEnd(stringBuilder); + return stringBuilder; + } + + public static final ToStringStrategy INSTANCE = new JAXBToStringStrategy(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java new file mode 100644 index 00000000..282145ca --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeFrom.java @@ -0,0 +1,15 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface MergeFrom { + + public Object createNewInstance(); + + public void mergeFrom(Object left, Object right); + + public void mergeFrom(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object left, Object right, + MergeStrategy mergeStrategy); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java new file mode 100644 index 00000000..43461494 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/MergeStrategy.java @@ -0,0 +1,60 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface MergeStrategy { + + public boolean merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, boolean left, boolean right); + + public byte merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + byte left, byte right); + + public char merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + char left, char right); + + public double merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + double left, double right); + + public float merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + float left, float right); + + public int merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + int left, int right); + + public long merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + long left, long right); + + public short merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + short left, short right); + + public Object merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + Object left, Object right); + + public boolean[] merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, boolean[] left, boolean[] right); + + public byte[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + byte[] left, byte[] right); + + public char[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + char[] left, char[] right); + + public double[] merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, double[] left, double[] right); + + public float[] merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, float[] left, float[] right); + + public int[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + int[] left, int[] right); + + public long[] merge(ObjectLocator leftLocator, ObjectLocator rightLocator, + long[] left, long[] right); + + public short[] merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, short[] left, short[] right); + + public Object[] merge(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object[] left, Object[] right); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java new file mode 100644 index 00000000..4ca0f078 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/StringUtils.java @@ -0,0 +1,90 @@ +package org.jvnet.jaxb2_commons.lang; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class StringUtils { + public static final String LINE_SEPARATOR = System + .getProperty("line.separator"); + public static final String EMPTY = ""; + public static final String[] EMPTY_STRING_ARRAY = new String[0]; + + public static boolean isEmpty(String str) { + return str == null || str.length() == 0; + } + + public static String[] split(String str, char separatorChar) { + return splitWorker(str, separatorChar, false); + } + + @SuppressWarnings("unchecked") + private static String[] splitWorker(String str, char separatorChar, + boolean preserveAllTokens) { + // Performance tuned for 2.0 (JDK1.4) + + if (str == null) { + return null; + } + int len = str.length(); + if (len == 0) { + return EMPTY_STRING_ARRAY; + } + List list = new ArrayList(); + int i = 0, start = 0; + boolean match = false; + boolean lastMatch = false; + while (i < len) { + if (str.charAt(i) == separatorChar) { + if (match || preserveAllTokens) { + list.add(str.substring(start, i)); + match = false; + lastMatch = true; + } + start = ++i; + continue; + } + lastMatch = false; + match = true; + i++; + } + if (match || (preserveAllTokens && lastMatch)) { + list.add(str.substring(start, i)); + } + return (String[]) list.toArray(new String[list.size()]); + } + + @SuppressWarnings("unchecked") + public static String join(Iterator iterator, String separator) { + + // handle null, zero and one elements before building a buffer + if (iterator == null) { + return null; + } + if (!iterator.hasNext()) { + return EMPTY; + } + Object first = iterator.next(); + if (!iterator.hasNext()) { + return first == null ? "" : first.toString(); + } + + // two or more elements + StringBuilder buf = new StringBuilder(256); // Java default is 16, + // probably too small + if (first != null) { + buf.append(first); + } + + while (iterator.hasNext()) { + buf.append(separator); + Object obj = iterator.next(); + if (obj != null) { + buf.append(obj); + } + } + + return buf.toString(); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java new file mode 100644 index 00000000..ef6367e4 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToString.java @@ -0,0 +1,13 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface ToString { + + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, + ToStringStrategy toStringStrategy); + + public StringBuilder appendFields(ObjectLocator locator, StringBuilder stringBuilder, + ToStringStrategy toStringStrategy); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java new file mode 100644 index 00000000..a6e1ca09 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/ToStringStrategy.java @@ -0,0 +1,46 @@ +package org.jvnet.jaxb2_commons.lang; + +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public interface ToStringStrategy { + + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, boolean[] value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, byte[] value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, char[] value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, double[] value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, float[] value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, int[] value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, long[] value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, short[] value); + public StringBuilder append(ObjectLocator locator, StringBuilder stringBuilder, Object[] value); + + public StringBuilder appendStart(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); + public StringBuilder appendEnd(ObjectLocator parentLocator, Object parent, StringBuilder stringBuilder); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, boolean[] value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, byte[] value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, char[] value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, double[] value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, float[] value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, int[] value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, long[] value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, short[] value); + public StringBuilder appendField(ObjectLocator parentLocator, Object parent, String fieldName, StringBuilder stringBuilder, Object[] value); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java new file mode 100644 index 00000000..dec78ab3 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/lang/Validate.java @@ -0,0 +1,40 @@ +package org.jvnet.jaxb2_commons.lang; + +import java.util.Collection; +import java.util.Iterator; + +public class Validate { + + public static void notNull(Object object) { + if (object == null) { + throw new IllegalArgumentException("The validated object is null"); + } + } + + public static void isTrue(boolean expression) { + if (expression == false) { + throw new IllegalArgumentException( + "The validated expression is false"); + } + } + + public static void notEmpty(Collection collection) { + if (collection == null || collection.size() == 0) { + throw new IllegalArgumentException( + "The validated collection is empty"); + } + } + + public static void noNullElements(Collection collection) { + Validate.notNull(collection); + int i = 0; + for (Iterator it = collection.iterator(); it.hasNext(); i++) { + if (it.next() == null) { + throw new IllegalArgumentException( + "The validated collection contains null element at index: " + + i); + } + } + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java new file mode 100644 index 00000000..a01e94ee --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/AbstractObjectLocator.java @@ -0,0 +1,162 @@ +package org.jvnet.jaxb2_commons.locator; + +import java.net.URL; +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import org.w3c.dom.Node; + +/** + * Abstract base class for event locators. + * + * @author Aleksei Valikov + */ +public abstract class AbstractObjectLocator implements ObjectLocator { + /** + * Parent locator. + */ + protected final ObjectLocator parentLocator; + /** + * Object. + */ + protected final Object object; + + /** + * Constructs a new validation event locator. + * + * @param parentLocator + * parent location (may be null). + * @param object + * object. + * @param propertyName + * field name. + */ + protected AbstractObjectLocator(final ObjectLocator parentLocator, + final Object object) { + this.object = object; + this.parentLocator = parentLocator; + } + + /** + * Returns parent locator. + * + * @return Parent locator. + */ + public ObjectLocator getParentLocator() { + return parentLocator; + } + + public ObjectLocator[] getPath() { + final ObjectLocator[] path = new ObjectLocator[getAncestorCount(this) + 1]; + fillPath(this, path, path.length - 1); + return path; + } + + public String getPathAsString() { + final String stepAsString = getStepAsString(); + final ObjectLocator parentLocator = getParentLocator(); + return parentLocator == null ? stepAsString : parentLocator + .getPathAsString() + stepAsString; + } + + protected abstract String getStepAsString(); + + private void fillPath(ObjectLocator locator, ObjectLocator[] path, int index) { + path[index] = locator; + final ObjectLocator parent = locator.getParentLocator(); + if (parent != null) + fillPath(parent, path, index - 1); + } + + private int getAncestorCount(ObjectLocator locator) { + final ObjectLocator parent = locator.getParentLocator(); + if (parent == null) + return 0; + else + return 1 + getAncestorCount(parent); + } + + public Object getObject() { + return object; + } + + public int getColumnNumber() { + return 0; + } + + public int getLineNumber() { + return 0; + } + + public int getOffset() { + return 0; + } + + public URL getURL() { + return null; + } + + public Node getNode() { + return null; + } + + // /** + // * Returns expression step (for EL and JXPath expressions). + // * @return Expression step. + // */ + // public abstract String getStep(); + + public String toString() { + return getMessage(); + } + + /** + * Returns message code. + * + * @return Message code. + */ + public String getMessageCode() { + return getClass().getName(); + } + + protected abstract String getDefaultMessage(); + + // public Object[] getMessageParameters() { + // return new Object[] { getObject() }; + // } + // + public String getMessage(ResourceBundle bundle) { + try { + final String messageTemplate = bundle.getString(getMessageCode()); + return MessageFormat + .format(messageTemplate, getMessageParameters()); + } catch (MissingResourceException mrex) { + return getDefaultMessage(); + } + } + + /** + * Returns location message. + * + * @return Location message. + */ + public String getMessage() { + return getMessage(ResourceBundle.getBundle(getClass().getPackage() + .getName() + ".messages")); + } + + // public int hashCode() { + // int hashCode = getObject().hashCode(); + // return hashCode; + // } + + public ItemObjectLocator item(int index, Object value) { + return new DefaultItemObjectLocator(this, index, value); + } + + public PropertyObjectLocator property(String name, Object value) { + return new DefaultPropertyObjectLocator(this, name, value); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java new file mode 100644 index 00000000..6e192af1 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultItemObjectLocator.java @@ -0,0 +1,54 @@ +package org.jvnet.jaxb2_commons.locator; + +import java.text.MessageFormat; + +/** + * Locator for the collection item. + */ +public final class DefaultItemObjectLocator extends AbstractObjectLocator + implements ItemObjectLocator { + /** + * Item index. + */ + protected final int index; + + /** + * Constructs a new item locator. + * + * @param parentLocator + * parent locator. + * @param itemIndex + * item index. + * @param itemValue + * item value. + */ + protected DefaultItemObjectLocator(final ObjectLocator parentLocator, + final int itemIndex, Object itemValue) { + super(parentLocator, itemValue); + this.index = itemIndex; + } + + /** + * Returns item index. + * + * @return Index of the item. + */ + public int getIndex() { + return index; + } + + public Object[] getMessageParameters() { + return new Object[] { getObject(), Integer.valueOf(getIndex()) }; + } + + @Override + protected String getDefaultMessage() { + return MessageFormat.format("Item index: {1}\nItem value: {0}.", + getMessageParameters()); + } + + @Override + protected String getStepAsString() { + return "[" + getIndex() + "]"; + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java new file mode 100644 index 00000000..063781ad --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultPropertyObjectLocator.java @@ -0,0 +1,58 @@ +package org.jvnet.jaxb2_commons.locator; + +import java.text.MessageFormat; + +/** + * Validation event locator. + * + * @author Aleksei Valikov + */ +public final class DefaultPropertyObjectLocator extends AbstractObjectLocator + implements PropertyObjectLocator { + + /** + * Field name. + */ + protected final String propertyName; + + /** + * Constructs a new validation event locator. + * + * @param parentLocator + * parent location (may be null). + * @param object + * object. + * @param propertyName + * field name. + */ + protected DefaultPropertyObjectLocator(final ObjectLocator parentLocator, + final String propertyName, final Object propertyValue) { + super(parentLocator, propertyValue); + this.propertyName = propertyName; + } + + public String getPropertyName() { + return propertyName; + } + + /** + * Returns parameters for message formatting. + * + * @return Message formatting parameters. + */ + public Object[] getMessageParameters() { + return new Object[] { getObject(), getPropertyName() }; + } + + @Override + protected String getDefaultMessage() { + return MessageFormat.format("Field: {1}\nField value: {0}.", + getMessageParameters()); + } + + @Override + protected String getStepAsString() { + return "." + getPropertyName(); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java new file mode 100644 index 00000000..201dcd30 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/DefaultRootObjectLocator.java @@ -0,0 +1,26 @@ +package org.jvnet.jaxb2_commons.locator; + +import java.text.MessageFormat; + +public final class DefaultRootObjectLocator extends AbstractObjectLocator + implements RootObjectLocator { + + public DefaultRootObjectLocator(Object rootObject) { + super(null, rootObject); + } + + public Object[] getMessageParameters() { + return new Object[] { getObject() }; + } + + @Override + protected String getDefaultMessage() { + return MessageFormat + .format("Root object: {0}.", getMessageParameters()); + } + + @Override + protected String getStepAsString() { + return ""; + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java new file mode 100644 index 00000000..43003127 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ItemObjectLocator.java @@ -0,0 +1,21 @@ +package org.jvnet.jaxb2_commons.locator; + +/** + * Models item locator. + * + * @author Aleksei Valikov + * + */ +public interface ItemObjectLocator extends ObjectLocator { + + /** + * @return Item index. + */ + public int getIndex(); + + /** + * @return Item value. + */ + public Object getObject(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java new file mode 100644 index 00000000..767d01cf --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/ObjectLocator.java @@ -0,0 +1,54 @@ +package org.jvnet.jaxb2_commons.locator; + +import javax.xml.bind.ValidationEventLocator; + +import org.jvnet.jaxb2_commons.i18n.Reportable; + +/** + * Object locator denotes a location in an object structure. + * + * @author Aleksei Valikov + * + */ +public interface ObjectLocator extends ValidationEventLocator, Reportable { + + /** + * @return Parent locator, may be null. + */ + public ObjectLocator getParentLocator(); + + /** + * @return Path to this locator from the root. + */ + public ObjectLocator[] getPath(); + + /** + * @return Path to this locator in string form; + */ + public String getPathAsString(); + + /** + * Creates a locator for the property, relative to this locator. + * + * @param propertyName + * name of the property, must not be null. + * @param propertyValue + * value of the property, may be null. + * @return Child property locator. + */ + public PropertyObjectLocator property(String propertyName, + Object propertyValue); + + /** + * Creates a locator for the item (like list or array item) relative to this + * locator. + * + * @param itemIndex + * index of the item. + * @param itemValue + * value of the item. + * @return Child item locator. + */ + public ItemObjectLocator item(int itemIndex, Object itemValue); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java new file mode 100644 index 00000000..c394ea88 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/PropertyObjectLocator.java @@ -0,0 +1,21 @@ +package org.jvnet.jaxb2_commons.locator; + +/** + * Models a property locator. + * + * @author Aleksei Valikov + * + */ +public interface PropertyObjectLocator extends ObjectLocator { + + /** + * @return Name of the property. + */ + public String getPropertyName(); + + /** + * @return Returns value of the property. + */ + public Object getObject(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java new file mode 100644 index 00000000..72f23926 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/RootObjectLocator.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.locator; + +public interface RootObjectLocator extends ObjectLocator { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java new file mode 100644 index 00000000..e8756384 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/locator/util/LocatorUtils.java @@ -0,0 +1,129 @@ +package org.jvnet.jaxb2_commons.locator.util; + +import org.jvnet.jaxb2_commons.locator.PropertyObjectLocator; +import org.jvnet.jaxb2_commons.locator.ItemObjectLocator; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.xml.sax.Locator; + +public class LocatorUtils { + + private LocatorUtils() { + + } + + public static String getLocation(Locator locator) { + if (locator == null) { + return ""; + } else { + return locator.getPublicId() + ":" + locator.getSystemId() + ":" + + locator.getLineNumber() + ":" + locator.getColumnNumber(); + } + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + Object value) { + return locator == null ? null : locator.property(name, value); + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + boolean value) { + return locator == null ? null : locator.property(name, Boolean + .valueOf(value)); + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + byte value) { + return locator == null ? null : locator + .property(name, Byte.valueOf(value)); + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + char value) { + return locator == null ? null : locator.property(name, Character + .valueOf(value)); + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + double value) { + return locator == null ? null : locator.property(name, Double + .valueOf(value)); + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + float value) { + return locator == null ? null : locator.property(name, Float + .valueOf(value)); + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + int value) { + return locator == null ? null : locator.property(name, Integer + .valueOf(value)); + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + long value) { + return locator == null ? null : locator + .property(name, Long.valueOf(value)); + } + + public static PropertyObjectLocator property(ObjectLocator locator, String name, + short value) { + return locator == null ? null : locator.property(name, Short + .valueOf(value)); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, Object value) { + return locator == null ? null : locator.item(index, value); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, boolean value) { + return locator == null ? null : locator.item(index, Boolean + .valueOf(value)); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, byte value) { + return locator == null ? null : locator.item(index, Byte + .valueOf(value)); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, char value) { + return locator == null ? null : locator.item(index, Character + .valueOf(value)); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, double value) { + return locator == null ? null : locator.item(index, Double + .valueOf(value)); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, float value) { + return locator == null ? null : locator.item(index, Float + .valueOf(value)); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, int value) { + return locator == null ? null : locator.item(index, Integer + .valueOf(value)); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, long value) { + return locator == null ? null : locator.item(index, Long + .valueOf(value)); + } + + public static ItemObjectLocator item(ObjectLocator locator, + int index, short value) { + return locator == null ? null : locator.item(index, Short + .valueOf(value)); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java new file mode 100644 index 00000000..c5396bd4 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterMarshallCallback.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xml.bind; + +import javax.xml.bind.Marshaller; + +public interface AfterMarshallCallback { + + public void afterMarshal(Marshaller marshaller); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java new file mode 100644 index 00000000..31cbca29 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/AfterUnmarshallCallback.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xml.bind; + +import javax.xml.bind.Unmarshaller; + +public interface AfterUnmarshallCallback { + + public void afterUnmarshal(Unmarshaller unmarshaller, Object parent); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java new file mode 100644 index 00000000..b3187ec4 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeMarshallCallback.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xml.bind; + +import javax.xml.bind.Marshaller; + +public interface BeforeMarshallCallback { + + public void beforeMarshal(Marshaller marshaller); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java new file mode 100644 index 00000000..ec15fe1d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/BeforeUnmarshallCallback.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xml.bind; + +import javax.xml.bind.Unmarshaller; + +public interface BeforeUnmarshallCallback { + + public void beforeUnmarshal(Unmarshaller unmarshaller, Object parent); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java new file mode 100644 index 00000000..147dcfea --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/ContextPathAware.java @@ -0,0 +1,19 @@ +package org.jvnet.jaxb2_commons.xml.bind; + + +/** + * Implemented by classes which are aware of JAXB context path. + * + * @author valikov + */ +public interface ContextPathAware { + + /** + * Returns JAXB context path which could be used to + * create a JAXBContext instance. + * + * @return JAXB context path. + */ + public String getContextPath(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java new file mode 100644 index 00000000..09ad0568 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/annotation/adapters/CommaDelimitedStringAdapter.java @@ -0,0 +1,42 @@ +package org.jvnet.jaxb2_commons.xml.bind.annotation.adapters; + +import java.util.LinkedList; +import java.util.List; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +import org.jvnet.jaxb2_commons.lang.StringUtils; + +public class CommaDelimitedStringAdapter extends + XmlAdapter> { + + @Override + public String marshal(List value) throws Exception { + if (value == null) { + return null; + } else { + return StringUtils.join(value.iterator(), ", "); + } + } + + @Override + public List unmarshal(String text) throws Exception { + + if (text == null) { + return null; + } else + + { + final List value = new LinkedList(); + final String[] items = StringUtils.split(text, ','); + for (String item : items) { + final String trimmedItem = item.trim(); + if (!StringUtils.isEmpty(trimmedItem)) { + value.add(trimmedItem); + } + } + return value; + } + } + +} \ No newline at end of file diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java new file mode 100644 index 00000000..8bc2911b --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyAttributePropertyInfo.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MAnyAttributePropertyInfo extends MPropertyInfo { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java new file mode 100644 index 00000000..99fb2cf1 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAnyElementPropertyInfo.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MAnyElementPropertyInfo extends MPropertyInfo, + MWildcard, MMixable { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java new file mode 100644 index 00000000..2e8321d7 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MAttributePropertyInfo.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import javax.xml.namespace.QName; + +public interface MAttributePropertyInfo extends + MSingleTypePropertyInfo { + + public QName getAttributeName(); + +} \ No newline at end of file diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java new file mode 100644 index 00000000..3de4c31e --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MBuiltinLeafInfo.java @@ -0,0 +1,13 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; + +public interface MBuiltinLeafInfo extends MTypeInfo, + MOriginated { + + public QName getTypeName(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java new file mode 100644 index 00000000..8eb6b54c --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassInfo.java @@ -0,0 +1,26 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; + +public interface MClassInfo extends MClassTypeInfo, + MOriginated { + + public MClassTypeInfo getBaseTypeInfo(); + + public List> getProperties(); + + public QName getElementName(); + + public MElementInfo createElementInfo(MTypeInfo scope, + QName substitutionHead); + + public void addProperty(MPropertyInfo propertyInfo); + + public void removeProperty(MPropertyInfo propertyInfo); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java new file mode 100644 index 00000000..281180cf --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassRef.java @@ -0,0 +1,4 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MClassRef extends MClassTypeInfo { +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java new file mode 100644 index 00000000..61d394a4 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfo.java @@ -0,0 +1,11 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MClassTypeInfo extends MPackagedTypeInfo, + MContainer { + + public C getTargetClass(); + + public V acceptClassTypeInfoVisitor( + MClassTypeInfoVisitor visitor); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java new file mode 100644 index 00000000..8eeda095 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MClassTypeInfoVisitor.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MClassTypeInfoVisitor { + + public V visitClassInfo(MClassInfo info); + + public V visitClassRef(MClassRef info); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java new file mode 100644 index 00000000..02434f15 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContained.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MContained { + + public MContainer getContainer(); + + public String getContainerLocalName(String delimiter); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java new file mode 100644 index 00000000..b5a4d00d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MContainer.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MContainer extends MPackaged { + + public String getLocalName(); + + public String getContainerLocalName(String delimiter); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java new file mode 100644 index 00000000..8bcd6d91 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizable.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MCustomizable { + + public MCustomizations getCustomizations(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java new file mode 100644 index 00000000..3b994ecd --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomization.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MCustomization { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java new file mode 100644 index 00000000..c27fc837 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MCustomizations.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import java.util.List; + +public interface MCustomizations { + + public List getCustomizations(); + + public void addCustomization(MCustomization customization); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java new file mode 100644 index 00000000..912eabf3 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementInfo.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; + +public interface MElementInfo extends MElementTypeInfo, MPackaged, + MOriginated, MContained, MContainer { + + public QName getElementName(); + + public MTypeInfo getScope(); + + public QName getSubstitutionHead(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java new file mode 100644 index 00000000..09e7b3d2 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementPropertyInfo.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MElementPropertyInfo extends MPropertyInfo, + MWrappable, MElementTypeInfo { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java new file mode 100644 index 00000000..505b2d7f --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefPropertyInfo.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MElementRefPropertyInfo extends MPropertyInfo, + MMixable, MWrappable, MWildcard, MElementTypeInfo { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java new file mode 100644 index 00000000..a3aab895 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementRefsPropertyInfo.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + + +public interface MElementRefsPropertyInfo extends MPropertyInfo, + MMixable, MWrappable, MWildcard, MElementTypeInfos { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java new file mode 100644 index 00000000..4e2cbd46 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfo.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import javax.xml.namespace.QName; + +public interface MElementTypeInfo extends MTyped { + + public QName getElementName(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java new file mode 100644 index 00000000..fda4ea7a --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementTypeInfos.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import java.util.List; + +public interface MElementTypeInfos { + public List> getElementTypeInfos(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java new file mode 100644 index 00000000..8859e9d6 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MElementsPropertyInfo.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + + +public interface MElementsPropertyInfo extends MPropertyInfo, + MWrappable, MElementTypeInfos { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java new file mode 100644 index 00000000..5249f0cb --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumConstantInfo.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; + +public interface MEnumConstantInfo extends + MOriginated { + + public String getLexicalValue(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java new file mode 100644 index 00000000..d4a38f15 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MEnumLeafInfo.java @@ -0,0 +1,28 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; + +public interface MEnumLeafInfo extends MPackagedTypeInfo, + MOriginated { + + public C getTargetClass(); + + public MTypeInfo getBaseTypeInfo(); + + public List> getConstants(); + + public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo); + + public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo); + + public QName getElementName(); + + public MElementInfo createElementInfo(MTypeInfo scope, + QName substitutionHead); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java new file mode 100644 index 00000000..cc7568aa --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MID.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MID extends MTypeInfo { + + public MTypeInfo getValueTypeInfo(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java new file mode 100644 index 00000000..684c7734 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREF.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MIDREF extends MTypeInfo { + + public MTypeInfo getValueTypeInfo(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java new file mode 100644 index 00000000..dca6c4f3 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MIDREFS.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MIDREFS extends MList { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java new file mode 100644 index 00000000..c35b0653 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MList.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MList extends MTypeInfo { + + public MTypeInfo getItemTypeInfo(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java new file mode 100644 index 00000000..f92d7417 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MMixable.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MMixable { + + public boolean isMixed(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java new file mode 100644 index 00000000..e6e0860d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MModelInfo.java @@ -0,0 +1,34 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import java.util.Collection; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; + +public interface MModelInfo extends MCustomizable, + MOriginated { + + public Collection> getBuiltinLeafInfos(); + + public Collection> getClassInfos(); + + public Collection> getEnumLeafInfos(); + + public Collection> getTypeInfos(); + + public Collection> getElementInfos(); + + public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo); + + public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo); + + public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo); + + public void addClassInfo(MClassInfo classInfo); + + public void removeClassInfo(MClassInfo classInfo); + + public void addElementInfo(MElementInfo elementInfo); + + public void removeElementInfo(MElementInfo elementInfo); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java new file mode 100644 index 00000000..8b8613fa --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackageInfo.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; + +public interface MPackageInfo extends MOriginated, + MContainer { + + public String getPackageName(); + + public String getPackagedName(String localName); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java new file mode 100644 index 00000000..afb4343f --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackaged.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MPackaged { + + public MPackageInfo getPackageInfo(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java new file mode 100644 index 00000000..76b30f17 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfo.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MPackagedTypeInfo extends MTypeInfo, MPackaged, + MContained { + + public String getName(); + + public String getLocalName(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java new file mode 100644 index 00000000..8c32e2fb --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPackagedTypeInfoVisitor.java @@ -0,0 +1,40 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public abstract class MPackagedTypeInfoVisitor implements + MTypeInfoVisitor { + + public abstract V visitPackagedTypeInfo(MPackagedTypeInfo info); + + public V visitList(MList info) { + return null; + } + + public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { + return null; + } + + public V visitID(MID info) { + return null; + } + + public V visitIDREF(MIDREF info) { + return null; + } + + public V visitIDREFS(MIDREFS info) { + return null; + } + + public V visitEnumLeafInfo(MEnumLeafInfo info) { + return visitPackagedTypeInfo(info); + } + + public V visitWildcardTypeInfo(MWildcardTypeInfo info) { + return null; + } + + public V visitClassInfo(MClassInfo info) { + return visitPackagedTypeInfo(info); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java new file mode 100644 index 00000000..a28c7798 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfo.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public interface MPropertyInfo extends MOriginated { + + public MClassInfo getClassInfo(); + + public String getPrivateName(); + + public String getPublicName(); + + public boolean isCollection(); + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java new file mode 100644 index 00000000..bedb17fc --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MPropertyInfoVisitor.java @@ -0,0 +1,21 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MPropertyInfoVisitor { + + public V visitElementPropertyInfo(MElementPropertyInfo info); + + public V visitElementsPropertyInfo(MElementsPropertyInfo info); + + public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info); + + public V visitAttributePropertyInfo(MAttributePropertyInfo info); + + public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info); + + public V visitValuePropertyInfo(MValuePropertyInfo info); + + public V visitElementRefPropertyInfo(MElementRefPropertyInfo info); + + public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java new file mode 100644 index 00000000..2d93ab1c --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSingleTypePropertyInfo.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MSingleTypePropertyInfo extends MPropertyInfo, + MTyped { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java new file mode 100644 index 00000000..02da1bed --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MSourced.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MSourced { + + public S getSource(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java new file mode 100644 index 00000000..a469ee11 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTargeted.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MTargeted { + + public T getTarget(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java new file mode 100644 index 00000000..64602728 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTransientPropertyInfo.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MTransientPropertyInfo { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java new file mode 100644 index 00000000..6149b249 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfo.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MTypeInfo extends MCustomizable { + + public T getTargetType(); + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java new file mode 100644 index 00000000..8ccd761d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTypeInfoVisitor.java @@ -0,0 +1,20 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MTypeInfoVisitor extends + MClassTypeInfoVisitor { + + public V visitList(MList info); + + public V visitID(MID info); + + public V visitIDREF(MIDREF info); + + public V visitIDREFS(MIDREFS info); + + public V visitBuiltinLeafInfo(MBuiltinLeafInfo info); + + public V visitEnumLeafInfo(MEnumLeafInfo info); + + public V visitWildcardTypeInfo(MWildcardTypeInfo info); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java new file mode 100644 index 00000000..2a36ddc6 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MTyped.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MTyped { + + public MTypeInfo getTypeInfo(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java new file mode 100644 index 00000000..b94ff57d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MValuePropertyInfo.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MValuePropertyInfo extends MSingleTypePropertyInfo { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java new file mode 100644 index 00000000..ebb5d6ab --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcard.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +public interface MWildcard { + + public boolean isDomAllowed(); + + public boolean isTypedObjectAllowed(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java new file mode 100644 index 00000000..c26fdab3 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWildcardTypeInfo.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MOriginated; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; + +public interface MWildcardTypeInfo extends MTypeInfo, + MOriginated { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java new file mode 100644 index 00000000..1e465869 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/MWrappable.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model; + +import javax.xml.namespace.QName; + +public interface MWrappable { + + public QName getWrapperElementName(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java new file mode 100644 index 00000000..9c23fe1d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyAttributePropertyInfo.java @@ -0,0 +1,20 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMAnyAttributePropertyInfo extends CMPropertyInfo + implements MAnyAttributePropertyInfo { + + public CMAnyAttributePropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName) { + super(origin, classInfo, privateName, false); + } + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { + return visitor.visitAnyAttributePropertyInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java new file mode 100644 index 00000000..e6b33789 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAnyElementPropertyInfo.java @@ -0,0 +1,40 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMAnyElementPropertyInfo extends CMPropertyInfo + implements MAnyElementPropertyInfo { + + private final boolean mixed; + private final boolean domAllowed; + private final boolean typedObjectAllowed; + + public CMAnyElementPropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, boolean collection, + boolean mixed, boolean domAllowed, boolean typedObjectAllowed) { + super(origin, classInfo, privateName, collection); + this.mixed = mixed; + this.domAllowed = domAllowed; + this.typedObjectAllowed = typedObjectAllowed; + } + + public boolean isMixed() { + return mixed; + } + + public boolean isDomAllowed() { + return domAllowed; + } + + public boolean isTypedObjectAllowed() { + return typedObjectAllowed; + } + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { + return visitor.visitAnyElementPropertyInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java new file mode 100644 index 00000000..9fe80d51 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMAttributePropertyInfo.java @@ -0,0 +1,33 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMAttributePropertyInfo extends + CMSingleTypePropertyInfo implements MAttributePropertyInfo { + + private final QName attributeName; + + public CMAttributePropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, + MTypeInfo typeInfo, QName attributeName) { + super(origin, classInfo, privateName, false, typeInfo); + Validate.notNull(attributeName); + this.attributeName = attributeName; + } + + public QName getAttributeName() { + return attributeName; + } + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { + return visitor.visitAttributePropertyInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java new file mode 100644 index 00000000..8c428397 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMBuiltinLeafInfo.java @@ -0,0 +1,51 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; + +public class CMBuiltinLeafInfo implements MBuiltinLeafInfo { + + private final MBuiltinLeafInfoOrigin origin; + private final T targetType; + private final QName typeName; + private final MCustomizations customizations = new CMCustomizations(); + + public CMBuiltinLeafInfo(MBuiltinLeafInfoOrigin origin, T targetType, + QName typeName) { + Validate.notNull(origin); + Validate.notNull(targetType); + Validate.notNull(typeName); + this.origin = origin; + this.targetType = targetType; + this.typeName = typeName; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public T getTargetType() { + return targetType; + } + + public MBuiltinLeafInfoOrigin getOrigin() { + return origin; + } + + public QName getTypeName() { + return typeName; + } + + public String toString() { + return "BuiltinLeafInfo [" + getTypeName() + "]"; + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitBuiltinLeafInfo(this); + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java new file mode 100644 index 00000000..4e51d210 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassInfo.java @@ -0,0 +1,166 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.PropertyInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; + +import com.sun.xml.bind.v2.model.core.ClassInfo; +import com.sun.xml.bind.v2.model.core.PropertyInfo; + +public class CMClassInfo implements MClassInfo { + + private final MClassInfoOrigin origin; + private CMCustomizations customizations = new CMCustomizations(); + private final C targetClass; + private final MPackageInfo _package; + private final String name; + private final String localName; + private final MContainer container; + private final MClassTypeInfo baseTypeInfo; + private final QName elementName; + + private List> properties = new ArrayList>(); + private List> unmodifiableProperties = Collections + .unmodifiableList(properties); + + public CMClassInfo(MClassInfoOrigin origin, C targetClass, + MPackageInfo _package, MContainer container, String localName, + MClassTypeInfo baseTypeInfo, QName elementName) { + super(); + Validate.notNull(origin); + Validate.notNull(targetClass); + Validate.notNull(_package); + Validate.notNull(localName); + this.origin = origin; + this.targetClass = targetClass; + this.name = _package.getPackagedName(localName); + this.localName = localName; + this._package = _package; + this.container = container; + this.baseTypeInfo = baseTypeInfo; + this.elementName = elementName; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public MClassInfoOrigin getOrigin() { + return origin; + } + + public C getTargetClass() { + return targetClass; + } + + public T getTargetType() { + return targetClass; + } + + public MElementInfo createElementInfo(MTypeInfo scope, + QName substitutionHead) { + return new CMElementInfo(getOrigin().createElementInfoOrigin(), + getPackageInfo(), getContainer(), getLocalName(), + getElementName(), scope, this, substitutionHead); + } + + public MPackageInfo getPackageInfo() { + return _package; + } + + public String getName() { + return name; + } + + public String getLocalName() { + return localName; + } + + public MContainer getContainer() { + return container; + } + + public String getContainerLocalName(String delimiter) { + final String localName = getLocalName(); + if (localName == null) { + return null; + } else { + final MContainer container = getContainer(); + if (container == null) { + return localName; + } else { + final String containerLocalName = container + .getContainerLocalName(delimiter); + return containerLocalName == null ? localName + : containerLocalName + delimiter + localName; + } + } + } + + public MContainer getScope() { + return container; + } + + public MClassTypeInfo getBaseTypeInfo() { + return baseTypeInfo; + } + + public List> getProperties() { + return unmodifiableProperties; + } + + public QName getElementName() { + return elementName; + } + + public void addProperty(MPropertyInfo propertyInfo) { + Validate.notNull(propertyInfo); + this.properties.add(propertyInfo); + } + + @SuppressWarnings("unchecked") + public void removeProperty(MPropertyInfo propertyInfo) { + Validate.notNull(propertyInfo); + this.properties.remove(propertyInfo); + + if (getOrigin() instanceof ClassInfoOrigin + && propertyInfo.getOrigin() instanceof PropertyInfoOrigin) { + ClassInfo ci = (ClassInfo) ((ClassInfoOrigin) getOrigin()) + .getSource(); + PropertyInfo pi = (PropertyInfo) ((PropertyInfoOrigin) propertyInfo + .getOrigin()).getSource(); + ci.getProperties().remove(pi); + } + } + + public String toString() { + return "ClassInfo [" + getName() + "]"; + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitClassInfo(this); + } + + @Override + public V acceptClassTypeInfoVisitor( + MClassTypeInfoVisitor visitor) { + return visitor.visitClassInfo(this); + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java new file mode 100644 index 00000000..97cb752d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMClassRef.java @@ -0,0 +1,90 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; + +public class CMClassRef implements MClassRef { + + private CMCustomizations customizations = new CMCustomizations(); + private final C targetClass; + private final MPackageInfo _package; + private final String name; + private final String localName; + private final MContainer container; + + public CMClassRef(/* MClassInfoOrigin origin, */C targetClass, + MPackageInfo _package, MContainer container, String localName) { + super(); + // Validate.notNull(origin); + Validate.notNull(targetClass); + Validate.notNull(_package); + Validate.notNull(localName); + // this.origin = origin; + this.targetClass = targetClass; + this.name = _package.getPackagedName(localName); + this.localName = localName; + this._package = _package; + this.container = container; + } + + public String getName() { + return name; + } + + public String getLocalName() { + return localName; + } + + public T getTargetType() { + return targetClass; + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitClassRef(this); + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public MPackageInfo getPackageInfo() { + return _package; + } + + public MContainer getContainer() { + return container; + } + + public String getContainerLocalName(String delimiter) { + final String localName = getLocalName(); + if (localName == null) { + return null; + } else { + final MContainer container = getContainer(); + if (container == null) { + return localName; + } else { + final String containerLocalName = container + .getContainerLocalName(delimiter); + return containerLocalName == null ? localName + : containerLocalName + delimiter + localName; + } + } + } + + public C getTargetClass() { + return targetClass; + } + + @Override + public V acceptClassTypeInfoVisitor( + MClassTypeInfoVisitor visitor) { + return visitor.visitClassRef(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java new file mode 100644 index 00000000..bdab79c4 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomization.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; +import org.w3c.dom.Element; + +public class CMCustomization implements MCustomization { + + private final Element element; + + public CMCustomization(Element element) { + this.element = element; + } + + public Element getElement() { + return element; + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java new file mode 100644 index 00000000..fede50a1 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMCustomizations.java @@ -0,0 +1,26 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomization; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; + +public class CMCustomizations implements MCustomizations { + + private final List customizations = new LinkedList(); + private final List unmodifiableCustomizations = Collections + .unmodifiableList(this.customizations); + + public List getCustomizations() { + return unmodifiableCustomizations; + } + + public void addCustomization(MCustomization customization) { + Validate.notNull(customization); + this.customizations.add(customization); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java new file mode 100644 index 00000000..af3aca98 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementInfo.java @@ -0,0 +1,104 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.text.MessageFormat; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; + +public class CMElementInfo implements MElementInfo { + + private final MElementInfoOrigin origin; + + private final MPackageInfo _package; + + private final MContainer container; + + private final String localName; + + private final QName elementName; + + private final MTypeInfo scope; + + private final MTypeInfo typeInfo; + + private final QName substitutionHead; + + public CMElementInfo(MElementInfoOrigin origin, MPackageInfo _package, + MContainer container, String localName, QName elementName, + MTypeInfo scope, MTypeInfo typeInfo, + QName substitutionHead) { + super(); + Validate.notNull(origin); + Validate.notNull(elementName); + Validate.notNull(_package); + this.origin = origin; + this._package = _package; + this.container = container; + this.localName = localName; + this.elementName = elementName; + this.scope = scope; + this.typeInfo = typeInfo; + this.substitutionHead = substitutionHead; + } + + public MElementInfoOrigin getOrigin() { + return origin; + } + + public MPackageInfo getPackageInfo() { + return _package; + } + + public MContainer getContainer() { + return container; + } + + public String getLocalName() { + return localName; + } + + public String getContainerLocalName(String delimiter) { + final String localName = getLocalName(); + if (localName == null) { + return null; + } else { + final MContainer container = getContainer(); + if (container == null) { + return localName; + } else { + final String containerLocalName = container + .getContainerLocalName(delimiter); + return containerLocalName == null ? localName + : containerLocalName + delimiter + localName; + } + } + } + + public QName getElementName() { + return elementName; + } + + public MTypeInfo getScope() { + return scope; + } + + public MTypeInfo getTypeInfo() { + return typeInfo; + } + + public QName getSubstitutionHead() { + return substitutionHead; + } + + public String toString() { + return MessageFormat.format("ElementInfo [{0}: {1}]", getElementName(), + getTypeInfo()); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java new file mode 100644 index 00000000..7dc79a6a --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementPropertyInfo.java @@ -0,0 +1,44 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMElementPropertyInfo extends CMPropertyInfo implements + MElementPropertyInfo { + + private final MTypeInfo typeInfo; + private final QName elementName; + private final QName wrapperElementName; + + public CMElementPropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, boolean collection, + MTypeInfo typeInfo, QName elementName, + QName wrapperElementName) { + super(origin, classInfo, privateName, collection); + this.typeInfo = typeInfo; + this.elementName = elementName; + this.wrapperElementName = wrapperElementName; + } + + public MTypeInfo getTypeInfo() { + return typeInfo; + } + + public QName getElementName() { + return elementName; + } + + public QName getWrapperElementName() { + return wrapperElementName; + } + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { + return visitor.visitElementPropertyInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java new file mode 100644 index 00000000..e7284873 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefPropertyInfo.java @@ -0,0 +1,64 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMElementRefPropertyInfo extends CMPropertyInfo + implements MElementRefPropertyInfo { + + private final MTypeInfo typeInfo; + private final QName elementName; + private final QName wrapperElementName; + + private final boolean mixed; + private final boolean domAllowed; + private final boolean typedObjectAllowed; + + public CMElementRefPropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, boolean collection, + MTypeInfo typeInfo, QName elementName, + QName wrapperElementName, boolean mixed, boolean domAllowed, + boolean typedObjectAllowed) { + super(origin, classInfo, privateName, collection); + this.typeInfo = typeInfo; + this.elementName = elementName; + this.wrapperElementName = wrapperElementName; + this.mixed = mixed; + this.domAllowed = domAllowed; + this.typedObjectAllowed = typedObjectAllowed; + } + + public MTypeInfo getTypeInfo() { + return typeInfo; + } + + public QName getElementName() { + return elementName; + } + + public QName getWrapperElementName() { + return wrapperElementName; + } + + public boolean isMixed() { + return mixed; + } + + public boolean isDomAllowed() { + return domAllowed; + } + + public boolean isTypedObjectAllowed() { + return typedObjectAllowed; + } + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { + return visitor.visitElementRefPropertyInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java new file mode 100644 index 00000000..f3d67cda --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementRefsPropertyInfo.java @@ -0,0 +1,70 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMElementRefsPropertyInfo extends CMPropertyInfo + implements MElementRefsPropertyInfo { + + private final QName wrapperElementName; + + private final List> elementTypeInfos = new ArrayList>(); + private final List> unmodifiableElementTypeInfos = Collections + .unmodifiableList(elementTypeInfos); + + private final boolean mixed; + private final boolean domAllowed; + private final boolean typedObjectAllowed; + + public CMElementRefsPropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, boolean collection, + Collection> elementTypeInfos, + QName wrapperElementName, boolean mixed, boolean domAllowed, + boolean typedObjectAllowed) { + super(origin, classInfo, privateName, collection); + Validate.noNullElements(elementTypeInfos); +// Validate.notEmpty(elementTypeInfos); +// Validate.isTrue(elementTypeInfos.size() > 1); + this.elementTypeInfos.addAll(elementTypeInfos); + this.wrapperElementName = wrapperElementName; + this.mixed = mixed; + this.domAllowed = domAllowed; + this.typedObjectAllowed = typedObjectAllowed; + } + + public List> getElementTypeInfos() { + return unmodifiableElementTypeInfos; + } + + public QName getWrapperElementName() { + return wrapperElementName; + } + + public boolean isMixed() { + return mixed; + } + + public boolean isDomAllowed() { + return domAllowed; + } + + public boolean isTypedObjectAllowed() { + return typedObjectAllowed; + } + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { + return visitor.visitElementRefsPropertyInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java new file mode 100644 index 00000000..02abb648 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementTypeInfo.java @@ -0,0 +1,34 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; + +public class CMElementTypeInfo implements MElementTypeInfo { + + private final QName elementName; + + private final MTypeInfo typeInfo; + + public CMElementTypeInfo(QName elementName, MTypeInfo typeInfo) { + Validate.notNull(elementName); + Validate.notNull(typeInfo); + this.elementName = elementName; + this.typeInfo = typeInfo; + } + + public QName getElementName() { + return elementName; + } + + public MTypeInfo getTypeInfo() { + return typeInfo; + } + + @Override + public String toString() { + return "Element [" + getElementName() + ":" + getTypeInfo() + "]"; + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java new file mode 100644 index 00000000..ec8eea9f --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMElementsPropertyInfo.java @@ -0,0 +1,49 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMElementsPropertyInfo extends CMPropertyInfo + implements MElementsPropertyInfo { + + private final List> elementTypeInfos = new ArrayList>(); + private final List> unmodifiableElementTypeInfos = Collections + .unmodifiableList(elementTypeInfos); + private final QName wrapperElementName; + + public CMElementsPropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, boolean collection, + Collection> elementTypeInfos, + QName wrapperElementName) { + super(origin, classInfo, privateName, collection); + Validate.noNullElements(elementTypeInfos); + Validate.notEmpty(elementTypeInfos); + Validate.isTrue(elementTypeInfos.size() > 1); + this.elementTypeInfos.addAll(elementTypeInfos); + this.wrapperElementName = wrapperElementName; + } + + public List> getElementTypeInfos() { + return unmodifiableElementTypeInfos; + } + + public QName getWrapperElementName() { + return wrapperElementName; + } + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { + return visitor.visitElementsPropertyInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java new file mode 100644 index 00000000..21279fba --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumConstantInfo.java @@ -0,0 +1,35 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; + +public class CMEnumConstantInfo implements MEnumConstantInfo { + + private final MEnumConstantInfoOrigin origin; + private final MEnumLeafInfo enumLeafInfo; + private final String lexicalValue; + + public CMEnumConstantInfo(MEnumConstantInfoOrigin origin, + MEnumLeafInfo enumLeafInfo, String lexicalValue) { + Validate.notNull(origin); + Validate.notNull(enumLeafInfo); + Validate.notNull(lexicalValue); + this.origin = origin; + this.enumLeafInfo = enumLeafInfo; + this.lexicalValue = lexicalValue; + } + + public MEnumConstantInfoOrigin getOrigin() { + return origin; + } + + public MEnumLeafInfo getEnumLeafInfo() { + return enumLeafInfo; + } + + public String getLexicalValue() { + return lexicalValue; + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java new file mode 100644 index 00000000..302752ed --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMEnumLeafInfo.java @@ -0,0 +1,174 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumConstantOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; + +import com.sun.xml.bind.v2.model.core.EnumConstant; +import com.sun.xml.bind.v2.model.core.EnumLeafInfo; + +public class CMEnumLeafInfo implements MEnumLeafInfo, + MCustomizable { + + private final MEnumLeafInfoOrigin origin; + private final CMCustomizations customizations = new CMCustomizations(); + private final C targetClass; + private final MPackageInfo _package; + private final MContainer container; + private final String name; + private final String localName; + private final MTypeInfo baseTypeInfo; + private final List> constants = new ArrayList>(); + private final List> _constants = Collections + .unmodifiableList(constants); + private final QName elementName; + + public CMEnumLeafInfo(MEnumLeafInfoOrigin origin, C targetClass, + MPackageInfo _package, MContainer container, String localName, + MTypeInfo baseTypeInfo, QName elementName) { + + Validate.notNull(origin); + Validate.notNull(targetClass); + Validate.notNull(_package); + Validate.notNull(localName); + Validate.notNull(baseTypeInfo); + this.origin = origin; + this.targetClass = targetClass; + this._package = _package; + this.container = container; + this.localName = localName; + this.name = _package.getPackagedName(localName); + this.baseTypeInfo = baseTypeInfo; + // May be null + this.elementName = elementName; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public MEnumLeafInfoOrigin getOrigin() { + return origin; + } + + public C getTargetClass() { + return targetClass; + } + + public T getTargetType() { + return targetClass; + } + + public MElementInfo createElementInfo(MTypeInfo scope, + QName substitutionHead) { + return new CMElementInfo(getOrigin().createElementInfoOrigin(), + getPackageInfo(), + getContainer(), + getLocalName(), + getElementName(), scope, this, + substitutionHead); + } + + public String getName() { + return name; + } + + public String getLocalName() { + return localName; + } + + + public MPackageInfo getPackageInfo() { + return _package; + } + + public MContainer getContainer() { + return container; + } + + public String getContainerLocalName(String delimiter) { + final String localName = getLocalName(); + if (localName == null) { + return null; + } else { + final MContainer container = getContainer(); + if (container == null) { + return localName; + } else { + final String containerLocalName = container + .getContainerLocalName(delimiter); + return containerLocalName == null ? localName + : containerLocalName + delimiter + localName; + } + } + } + + public MTypeInfo getBaseTypeInfo() { + return baseTypeInfo; + } + + public List> getConstants() { + return _constants; + } + + public void addEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { + Validate.notNull(enumConstantInfo); + this.constants.add(enumConstantInfo); + } + + @SuppressWarnings("unchecked") + public void removeEnumConstantInfo(MEnumConstantInfo enumConstantInfo) { + Validate.notNull(enumConstantInfo); + + if (getOrigin() instanceof EnumLeafInfoOrigin + && enumConstantInfo.getOrigin() instanceof EnumConstantOrigin) { + // TODO + EnumLeafInfo eli = (EnumLeafInfo) ((EnumLeafInfoOrigin) getOrigin()) + .getSource(); + EnumConstant ec = (EnumConstant) ((EnumConstantOrigin) enumConstantInfo + .getOrigin()).getSource(); + + Iterator iterator = eli.getConstants().iterator(); + + while (iterator.hasNext()) { + if (iterator.next() == ec) { + iterator.remove(); + } + } + } + // TODO Auto-generated method stub + + } + + public QName getElementName() { + return elementName; + } + + @Override + public String toString() { + return MessageFormat.format("EnumInfo [{0}]", getBaseTypeInfo()); + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitEnumLeafInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java new file mode 100644 index 00000000..b73b72eb --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMID.java @@ -0,0 +1,51 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.text.MessageFormat; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MID; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; + +public class CMID implements MID { + + private final MTypeInfo valueTypeInfo; + private final T targetType; + private final MCustomizations customizations = new CMCustomizations(); + + public CMID(T targetType, MTypeInfo itemTypeInfo) { + Validate.notNull(targetType); + Validate.notNull(itemTypeInfo); + this.targetType = targetType; + this.valueTypeInfo = itemTypeInfo; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public T getTargetType() { + return targetType; + } + + public MTypeInfo getValueTypeInfo() { + return valueTypeInfo; + } + + public QName getTypeName() { + return XmlSchemaConstants.ID; + } + + @Override + public String toString() { + return MessageFormat.format("ID [{0}]", getValueTypeInfo()); + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitID(this); + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java new file mode 100644 index 00000000..8073b9cc --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREF.java @@ -0,0 +1,51 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.text.MessageFormat; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xmlschema.XmlSchemaConstants; + +public class CMIDREF implements MIDREF { + + private final MTypeInfo valueTypeInfo; + private final T targetType; + private final MCustomizations customizations = new CMCustomizations(); + + public CMIDREF(T targetType, MTypeInfo itemTypeInfo) { + Validate.notNull(targetType); + Validate.notNull(itemTypeInfo); + this.targetType = targetType; + this.valueTypeInfo = itemTypeInfo; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public T getTargetType() { + return targetType; + } + + public MTypeInfo getValueTypeInfo() { + return valueTypeInfo; + } + + public QName getTypeName() { + return XmlSchemaConstants.ID; + } + + @Override + public String toString() { + return MessageFormat.format("ID [{0}]", getValueTypeInfo()); + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitIDREF(this); + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java new file mode 100644 index 00000000..50adc17c --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMIDREFS.java @@ -0,0 +1,23 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.text.MessageFormat; + +import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; + +public class CMIDREFS extends CMList implements MIDREFS { + + public CMIDREFS(T targetType, MTypeInfo itemTypeInfo) { + super(targetType, itemTypeInfo); + } + + @Override + public String toString() { + return MessageFormat.format("IDREFS [{0}]", getItemTypeInfo()); + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitIDREFS(this); + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java new file mode 100644 index 00000000..ab68f3c8 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMInfoFactory.java @@ -0,0 +1,538 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.activation.MimeType; +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMAnyAttributePropertyInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMBuiltinLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMWildcardTypeInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; + +import com.sun.xml.bind.v2.model.core.Adapter; +import com.sun.xml.bind.v2.model.core.AttributePropertyInfo; +import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; +import com.sun.xml.bind.v2.model.core.ClassInfo; +import com.sun.xml.bind.v2.model.core.Element; +import com.sun.xml.bind.v2.model.core.ElementInfo; +import com.sun.xml.bind.v2.model.core.ElementPropertyInfo; +import com.sun.xml.bind.v2.model.core.EnumConstant; +import com.sun.xml.bind.v2.model.core.EnumLeafInfo; +import com.sun.xml.bind.v2.model.core.ID; +import com.sun.xml.bind.v2.model.core.MapPropertyInfo; +import com.sun.xml.bind.v2.model.core.PropertyInfo; +import com.sun.xml.bind.v2.model.core.ReferencePropertyInfo; +import com.sun.xml.bind.v2.model.core.TypeInfo; +import com.sun.xml.bind.v2.model.core.TypeInfoSet; +import com.sun.xml.bind.v2.model.core.TypeRef; +import com.sun.xml.bind.v2.model.core.ValuePropertyInfo; +import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; + +public abstract class CMInfoFactory, +// +TI extends TypeInfo, +// +BLI extends BuiltinLeafInfo, +// +EI extends ElementInfo, +// +ELI extends EnumLeafInfo, +// +EC extends EnumConstant, +// +CI extends ClassInfo, +// +PI extends PropertyInfo, +// +API extends AttributePropertyInfo, +// +VPI extends ValuePropertyInfo, +// +EPI extends ElementPropertyInfo, +// +RPI extends ReferencePropertyInfo, +// +WTI extends WildcardTypeInfo> { + + private final Map> builtinLeafInfos = new IdentityHashMap>(); + + private final Map> classInfos = new IdentityHashMap>(); + + private final Map> enumLeafInfos = new IdentityHashMap>(); + + private final Map> elementInfos = new IdentityHashMap>(); + + private final TIS typeInfoSet; + + public CMInfoFactory(TIS typeInfoSet) { + Validate.notNull(typeInfoSet); + this.typeInfoSet = typeInfoSet; + + } + + public MModelInfo createModel() { + final CMModel model = new CMModel( + createModelInfoOrigin(typeInfoSet)); + + createBuiltinLeafInfos(model); + createEnumLeafInfos(model); + createClassInfos(model); + createElementInfos(model); + return model; + + } + + private void createElementInfos(final CMModel model) { + Iterable> elements = typeInfoSet + .getAllElements(); + for (ElementInfo element : elements) { + final EI ei = (EI) element; + elementInfos.put(ei, createElementInfo(ei)); + } + for (ElementInfo element : elements) { + model.addElementInfo(getElementInfo((EI) element)); + } + } + + private void createEnumLeafInfos(final CMModel model) { + Collection> enums = typeInfoSet.enums() + .values(); + for (EnumLeafInfo enumLeafInfo : enums) { + @SuppressWarnings("unchecked") + final ELI eli = (ELI) enumLeafInfo; + enumLeafInfos.put(eli, createEnumLeafInfo(eli)); + } + for (Map.Entry> entry : enumLeafInfos + .entrySet()) { + populateEnumLeafInfo(entry.getKey(), entry.getValue()); + } + for (EnumLeafInfo enumLeafInfo : enums) { + model.addEnumLeafInfo(getTypeInfo((ELI) enumLeafInfo)); + } + } + + private void createBuiltinLeafInfos(final CMModel model) { + Collection> builtins = typeInfoSet + .builtins().values(); + for (BuiltinLeafInfo builtinLeafInfo : builtins) { + @SuppressWarnings("unchecked") + final BLI bli = (BLI) builtinLeafInfo; + builtinLeafInfos.put(bli, createBuiltinLeafInfo(bli)); + } + for (BuiltinLeafInfo builtinLeafInfo : builtins) { + model.addBuiltinLeafInfo(getTypeInfo((BLI) builtinLeafInfo)); + } + } + + private void createClassInfos(final CMModel model) { + Collection> beans = typeInfoSet.beans() + .values(); + + for (ClassInfo classInfo : beans) { + @SuppressWarnings("unchecked") + final CI ci = (CI) classInfo; + classInfos.put(ci, createClassInfo(ci)); + } + for (Map.Entry> entry : classInfos.entrySet()) { + populateClassInfo(entry.getKey(), entry.getValue()); + } + for (ClassInfo classInfo : beans) { + model.addClassInfo(getTypeInfo((CI) classInfo)); + } + } + + protected MTypeInfo getTypeInfo(PropertyInfo propertyInfo, + TI typeInfo, boolean list, Adapter adapter, ID id, + MimeType mimeType) { + final MTypeInfo ti = getTypeInfo(typeInfo); + + if (list) { + switch (id) { + case ID: + final MTypeInfo tid = new CMID(ti.getTargetType(), + ti); + return new CMList(createListType(tid.getTargetType()), + tid); + case IDREF: + return new CMIDREFS(createListType(ti.getTargetType()), + ti); + default: + return new CMList(createListType(ti.getTargetType()), ti); + } + } else { + switch (id) { + case ID: + return new CMID(ti.getTargetType(), ti); + case IDREF: + return new CMIDREF(ti.getTargetType(), ti); + default: + return ti; + } + } + + } + + protected MTypeInfo getTypeInfo(TI typeInfo) { + if (typeInfo instanceof BuiltinLeafInfo) { + return getTypeInfo((BLI) typeInfo); + } else if (typeInfo instanceof EnumLeafInfo) { + return getTypeInfo((ELI) typeInfo); + } else if (typeInfo instanceof ElementInfo) { + return getTypeInfo((EI) typeInfo); + } else if (typeInfo instanceof WildcardTypeInfo) { + return createWildcardTypeInfo((WTI) typeInfo); + } else if (typeInfo instanceof ClassInfo) { + return getTypeInfo((CI) typeInfo); + } else { + throw new UnsupportedOperationException(typeInfo.getClass() + .getName()); + } + } + + private MBuiltinLeafInfo getTypeInfo(BLI typeInfo) { + return builtinLeafInfos.get(typeInfo); + } + + private MTypeInfo getTypeInfo(EI info) { + @SuppressWarnings("unchecked") + EPI p = (EPI) info.getProperty(); + @SuppressWarnings("unchecked") + TI contentType = (TI) info.getContentType(); + return getTypeInfo(p, contentType, p.isValueList(), p.getAdapter(), + p.id(), p.getExpectedMimeType()); + } + + protected MClassInfo getTypeInfo(CI info) { + return classInfos.get(info); + } + + private MEnumLeafInfo getTypeInfo(ELI info) { + return enumLeafInfos.get(info); + + } + + private void populateEnumLeafInfo(ELI info, MEnumLeafInfo enumLeafInfo) { + @SuppressWarnings("rawtypes") + Iterable _constants = info.getConstants(); + @SuppressWarnings("unchecked") + final Iterable> enumConstants = (Iterable>) _constants; + for (EnumConstant enumConstant : enumConstants) { + enumLeafInfo.addEnumConstantInfo(createEnumContantInfo( + enumLeafInfo, (EC) enumConstant)); + } + } + + protected MElementInfo getElementInfo(EI info) { + return elementInfos.get(info); + + } + + protected MClassInfo createClassInfo(CI info) { + return new CMClassInfo(createClassInfoOrigin(info), + info.getClazz(), getPackage(info), getContainer(info), + getLocalName(info), createBaseTypeInfo(info), + info.isElement() ? info.getElementName() : null); + } + + private void populateClassInfo(CI info, MClassInfo classInfo) { + + if (info.hasAttributeWildcard()) { + classInfo.addProperty(createAnyAttributePropertyInfo(classInfo)); + } + + for (PropertyInfo p : (List>) info + .getProperties()) { + classInfo.addProperty(createPropertyInfo(classInfo, (PI) p)); + } + } + + protected MClassTypeInfo createBaseTypeInfo(CI info) { + return info.getBaseClass() == null ? null : getTypeInfo((CI) info + .getBaseClass()); + } + + private MPropertyInfo createPropertyInfo( + final MClassInfo classInfo, PI p) { + + if (p instanceof AttributePropertyInfo) { + @SuppressWarnings("unchecked") + final API api = (API) p; + return createAttributePropertyInfo(classInfo, api); + } else if (p instanceof ValuePropertyInfo) { + @SuppressWarnings("unchecked") + final VPI vpi = (VPI) p; + return createValuePropertyInfo(classInfo, vpi); + } else if (p instanceof ElementPropertyInfo) { + @SuppressWarnings("unchecked") + final EPI ep = (EPI) p; + if (ep.getTypes().size() == 1) { + return createElementPropertyInfo(classInfo, ep); + } else { + return createElementsPropertyInfo(classInfo, ep); + + } + } else if (p instanceof ReferencePropertyInfo) { + @SuppressWarnings("unchecked") + final RPI rp = (RPI) p; + final Set> elements = rp.getElements(); + if (elements.size() == 0 + && rp.getWildcard() != null + && (rp.getWildcard().allowDom || rp.getWildcard().allowTypedObject)) { + return createAnyElementPropertyInfo(classInfo, rp); + } else if (elements.size() == 1) { + return createElementRefPropertyInfo(classInfo, rp); + } else { + return createElementRefsPropertyInfo(classInfo, rp); + } + } else if (p instanceof MapPropertyInfo) { + // System.out.println("Map property: " + p.getName()); + // MapPropertyInfo mp = (MapPropertyInfo) p; + throw new UnsupportedOperationException(); + } else { + throw new AssertionError(); + } + + } + + protected MPropertyInfo createAttributePropertyInfo( + final MClassInfo classInfo, final API propertyInfo) { + return new CMAttributePropertyInfo( + createPropertyInfoOrigin((PI) propertyInfo), classInfo, + propertyInfo.getName(), getTypeInfo(propertyInfo), + propertyInfo.getXmlName()); + } + + protected MPropertyInfo createValuePropertyInfo( + final MClassInfo classInfo, final VPI propertyInfo) { + return new CMValuePropertyInfo( + createPropertyInfoOrigin((PI) propertyInfo), classInfo, + propertyInfo.getName(), getTypeInfo(propertyInfo)); + } + + protected MPropertyInfo createElementPropertyInfo( + final MClassInfo classInfo, final EPI ep) { + final TypeRef typeRef = ep.getTypes().get(0); + return new CMElementPropertyInfo( + createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), + ep.isCollection() && !ep.isValueList(), + getTypeInfo(ep, typeRef), typeRef.getTagName(), ep.getXmlName()); + } + + protected MPropertyInfo createElementsPropertyInfo( + final MClassInfo classInfo, final EPI ep) { + List> types = ep.getTypes(); + final Collection> typedElements = new ArrayList>( + types.size()); + for (TypeRef typeRef : types) { + typedElements.add(new CMElementTypeInfo(typeRef.getTagName(), + getTypeInfo(ep, typeRef))); + } + return new CMElementsPropertyInfo( + createPropertyInfoOrigin((PI) ep), classInfo, ep.getName(), + ep.isCollection() && !ep.isValueList(), typedElements, + ep.getXmlName()); + } + + protected MPropertyInfo createAnyElementPropertyInfo( + final MClassInfo classInfo, final RPI rp) { + return new CMAnyElementPropertyInfo( + createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), + rp.isCollection(), rp.isMixed(), rp.getWildcard().allowDom, + rp.getWildcard().allowTypedObject); + } + + protected MPropertyInfo createElementRefPropertyInfo( + final MClassInfo classInfo, final RPI rp) { + final Element element = rp.getElements().iterator().next(); + return new CMElementRefPropertyInfo( + createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), + rp.isCollection(), getTypeInfo(rp, element), + element.getElementName(), rp.getXmlName(), + + rp.isMixed(), rp.getWildcard() == null ? false + : rp.getWildcard().allowDom, + rp.getWildcard() == null ? false + : rp.getWildcard().allowTypedObject); + } + + protected MPropertyInfo createElementRefsPropertyInfo( + final MClassInfo classInfo, final RPI rp) { + final List> typedElements = new ArrayList>(); + for (Element element : rp.getElements()) { + typedElements.add(new CMElementTypeInfo(element + .getElementName(), getTypeInfo(rp, element))); + } + return new CMElementRefsPropertyInfo( + createPropertyInfoOrigin((PI) rp), classInfo, rp.getName(), + rp.isCollection(), typedElements, rp.getXmlName(), + rp.isMixed(), rp.getWildcard() == null ? false + : rp.getWildcard().allowDom, + rp.getWildcard() == null ? false + : rp.getWildcard().allowTypedObject); + } + + protected CMAnyAttributePropertyInfo createAnyAttributePropertyInfo( + final MClassInfo classInfo) { + return new CMAnyAttributePropertyInfo( + createAnyAttributePropertyInfoOrigin(), classInfo, + "otherAttributes"); + } + + protected MTypeInfo getTypeInfo(final ValuePropertyInfo vp) { + return getTypeInfo(vp, (TI) vp.ref().iterator().next(), + vp.isCollection(), vp.getAdapter(), vp.id(), + vp.getExpectedMimeType()); + } + + protected MTypeInfo getTypeInfo(final AttributePropertyInfo ap) { + return getTypeInfo(ap, (TI) ap.ref().iterator().next(), + ap.isCollection(), ap.getAdapter(), ap.id(), + ap.getExpectedMimeType()); + } + + protected MTypeInfo getTypeInfo(final ElementPropertyInfo ep, + final TypeRef typeRef) { + return getTypeInfo(ep, (TI) typeRef.getTarget(), + + ep.isValueList(), ep.getAdapter(), ep.id(), ep.getExpectedMimeType()); + } + + protected MTypeInfo getTypeInfo(final ReferencePropertyInfo rp, + Element element) { + return getTypeInfo(rp, (TI) element, false, rp.getAdapter(), rp.id(), + rp.getExpectedMimeType()); + } + + protected abstract MPackageInfo getPackage(CI info); + + protected abstract String getLocalName(CI info); + + protected abstract MClassInfo getScope(CI info); + + protected abstract MPackageInfo getPackage(ELI info); + + protected abstract String getLocalName(ELI info); + + protected abstract String getLocalName(EI info); + + protected abstract MPackageInfo getPackage(EI info); + + protected abstract MContainer getContainer(CI info); + + protected abstract MContainer getContainer(EI info); + + protected abstract MContainer getContainer(ELI info); + + // + + protected MBuiltinLeafInfo createBuiltinLeafInfo(BLI info) { + return new CMBuiltinLeafInfo(createBuiltinLeafInfoOrigin(info), + info.getType(), info.getTypeName()); + } + + protected MEnumLeafInfo createEnumLeafInfo(final ELI info) { + @SuppressWarnings("unchecked") + final TI baseType = (TI) info.getBaseType(); + return new CMEnumLeafInfo(createEnumLeafInfoOrigin(info), + info.getClazz(), getPackage(info), getContainer(info), + getLocalName(info), getTypeInfo(baseType), + info.getElementName()); + } + + protected CMEnumConstantInfo createEnumContantInfo( + MEnumLeafInfo enumLeafInfo, EC enumConstant) { + return new CMEnumConstantInfo( + createEnumConstantInfoOrigin(enumConstant), enumLeafInfo, + enumConstant.getLexicalValue()); + } + + protected MElementInfo createElementInfo(EI element) { + @SuppressWarnings("unchecked") + final CI scopeCI = (CI) element.getScope(); + final MClassInfo scope = element.getScope() == null ? null + : getTypeInfo(scopeCI); + final QName substitutionHead = element.getSubstitutionHead() == null ? null + : element.getSubstitutionHead().getElementName(); + final MElementInfo elementInfo = new CMElementInfo( + createElementInfoOrigin(element), getPackage(element), + getContainer(element), getLocalName(element), + element.getElementName(), scope, getTypeInfo(element), + substitutionHead); + return elementInfo; + } + + protected MTypeInfo createWildcardTypeInfo(WTI info) { + return new CMWildcardTypeInfo(createWildcardTypeInfoOrigin(info), + info.getType()); + } + + protected MModelInfoOrigin createModelInfoOrigin(TIS info) { + return new CMModelInfoOrigin(info); + } + + protected MBuiltinLeafInfoOrigin createBuiltinLeafInfoOrigin(BLI info) { + return new CMBuiltinLeafInfoOrigin(info); + } + + protected MClassInfoOrigin createClassInfoOrigin(CI info) { + return new CMClassInfoOrigin(info); + } + + protected MPropertyInfoOrigin createAnyAttributePropertyInfoOrigin() { + return new CMAnyAttributePropertyInfoOrigin(); + } + + protected MPropertyInfoOrigin createPropertyInfoOrigin(PI info) { + return new CMPropertyInfoOrigin(info); + } + + protected MElementInfoOrigin createElementInfoOrigin(EI info) { + return new CMElementInfoOrigin(info); + } + + protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(ELI info) { + return new CMEnumLeafInfoOrigin(info); + } + + protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin(EC info) { + return new CMEnumConstantInfoOrigin(info); + } + + protected MWildcardTypeInfoOrigin createWildcardTypeInfoOrigin(WTI info) { + return new CMWildcardTypeInfoOrigin(info); + } + + protected abstract T createListType(T elementType); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java new file mode 100644 index 00000000..8a9edbdd --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMList.java @@ -0,0 +1,44 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.text.MessageFormat; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MList; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; + +public class CMList implements MList { + + private final MTypeInfo itemTypeInfo; + private final T targetType; + private final MCustomizations customizations = new CMCustomizations(); + + public CMList(T targetType, MTypeInfo itemTypeInfo) { + Validate.notNull(targetType); + Validate.notNull(itemTypeInfo); + this.targetType = targetType; + this.itemTypeInfo = itemTypeInfo; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public T getTargetType() { + return targetType; + } + + public MTypeInfo getItemTypeInfo() { + return itemTypeInfo; + } + + @Override + public String toString() { + return MessageFormat.format("List [{0}]", getItemTypeInfo()); + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitList(this); + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java new file mode 100644 index 00000000..026dd589 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMModel.java @@ -0,0 +1,216 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ClassInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.ElementInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.EnumLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.TypeInfoSetOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; + +import com.sun.xml.bind.v2.model.core.ClassInfo; +import com.sun.xml.bind.v2.model.core.ElementInfo; +import com.sun.xml.bind.v2.model.core.EnumLeafInfo; +import com.sun.xml.bind.v2.model.core.TypeInfoSet; + +public class CMModel implements MModelInfo { + + private final MModelInfoOrigin origin; + + private final CMCustomizations customizations = new CMCustomizations(); + + private final Collection> builtinLeafInfos = new ArrayList>(); + private final Collection> unmodifiableBuiltinLeafInfos = Collections + .unmodifiableCollection(builtinLeafInfos); + private final Map> builtinLeafInfosMap = new HashMap>(); + private final Map> unmodifiableBuiltinLeafInfosMap = Collections + .unmodifiableMap(builtinLeafInfosMap); + + private final Collection> classInfos = new ArrayList>(); + private final Collection> unmodifiableClassInfos = Collections + .unmodifiableCollection(classInfos); + + private final Collection> enumLeafInfos = new ArrayList>(); + private final Collection> unmodifiableEnumLeafInfos = Collections + .unmodifiableCollection(enumLeafInfos); + + private final Collection> typeInfos = new ArrayList>(); + private final Collection> unmodifiableTypeInfos = Collections + .unmodifiableCollection(typeInfos); + + private final Collection> elementInfos = new ArrayList>(); + private final Collection> unmodifiableElementInfos = Collections + .unmodifiableCollection(elementInfos); + + private final Map> elementInfosMap = new HashMap>(); + private final Map> unmodifiableElementInfosMap = Collections + .unmodifiableMap(elementInfosMap); + + public CMModel(MModelInfoOrigin origin) { + Validate.notNull(origin); + this.origin = origin; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public MModelInfoOrigin getOrigin() { + return origin; + } + + public Collection> getBuiltinLeafInfos() { + return unmodifiableBuiltinLeafInfos; + } + + public Collection> getClassInfos() { + return unmodifiableClassInfos; + } + + public Collection> getEnumLeafInfos() { + return unmodifiableEnumLeafInfos; + } + + public Collection> getElementInfos() { + return unmodifiableElementInfos; + } + + public Map> getElementInfosMap() { + return unmodifiableElementInfosMap; + } + + public Collection> getTypeInfos() { + return unmodifiableTypeInfos; + } + + public MBuiltinLeafInfo getBuiltinLeafInfo(QName name) { + Validate.notNull(name); + return this.unmodifiableBuiltinLeafInfosMap.get(name); + } + + public void addBuiltinLeafInfo(MBuiltinLeafInfo builtinLeafInfo) { + Validate.notNull(builtinLeafInfo); + this.builtinLeafInfos.add(builtinLeafInfo); + this.typeInfos.add(builtinLeafInfo); + this.builtinLeafInfosMap.put(builtinLeafInfo.getTypeName(), + builtinLeafInfo); + } + + public void addEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { + Validate.notNull(enumLeafInfo); + this.enumLeafInfos.add(enumLeafInfo); + this.typeInfos.add(enumLeafInfo); + final QName elementName = enumLeafInfo.getElementName(); + if (elementName != null) { + final MElementInfo elementInfo = enumLeafInfo + .createElementInfo(null, null); + this.elementInfos.add(elementInfo); + this.elementInfosMap.put(elementName, elementInfo); + } + + } + + public void removeEnumLeafInfo(MEnumLeafInfo enumLeafInfo) { + Validate.notNull(enumLeafInfo); + this.enumLeafInfos.remove(enumLeafInfo); + this.typeInfos.remove(enumLeafInfo); + final QName elementName = enumLeafInfo.getElementName(); + if (elementName != null) { + final MElementInfo elementInfo = this.elementInfosMap + .remove(elementName); + if (elementInfo != null) { + this.elementInfos.remove(elementInfo); + } + } + // TODO Not very good + if (getOrigin() instanceof TypeInfoSetOrigin + && enumLeafInfo.getOrigin() instanceof EnumLeafInfoOrigin) { + + final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) + .getSource(); + + final EnumLeafInfo eli = ((EnumLeafInfoOrigin>) enumLeafInfo + .getOrigin()).getSource(); + tis.enums().remove(eli.getClazz()); + } + } + + public void addClassInfo(MClassInfo classInfo) { + Validate.notNull(classInfo); + this.classInfos.add(classInfo); + this.typeInfos.add(classInfo); + + final QName elementName = classInfo.getElementName(); + if (elementName != null) { + final MElementInfo elementInfo = classInfo.createElementInfo( + null, null); + this.elementInfos.add(elementInfo); + this.elementInfosMap.put(elementName, elementInfo); + } + } + + public void removeClassInfo(MClassInfo classInfo) { + Validate.notNull(classInfo); + this.classInfos.remove(classInfo); + this.typeInfos.remove(classInfo); + final QName elementName = classInfo.getElementName(); + if (elementName != null) { + final MElementInfo elementInfo = this.elementInfosMap + .remove(elementName); + if (elementInfo != null) { + this.elementInfos.remove(elementInfo); + } + } + if (getOrigin() instanceof TypeInfoSetOrigin + && classInfo.getOrigin() instanceof ClassInfoOrigin) { + final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) + .getSource(); + final ClassInfo ci = ((ClassInfoOrigin>) classInfo + .getOrigin()).getSource(); + tis.beans().remove(ci); + + } + } + + public void addElementInfo(MElementInfo elementInfo) { + Validate.notNull(elementInfo); + Validate.notNull(elementInfo.getElementName()); + this.elementInfos.add(elementInfo); + this.elementInfosMap.put(elementInfo.getElementName(), elementInfo); + + } + + public void removeElementInfo(MElementInfo elementInfo) { + Validate.notNull(elementInfo); + Validate.notNull(elementInfo.getElementName()); + this.elementInfos.remove(elementInfo); + this.elementInfosMap.remove(elementInfo.getElementName()); + // TODO Not very good + if (getOrigin() instanceof TypeInfoSetOrigin + && elementInfo.getOrigin() instanceof ElementInfoOrigin) { + final TypeInfoSet tis = ((TypeInfoSetOrigin>) getOrigin()) + .getSource(); + + final ElementInfo ei = ((ElementInfoOrigin>) elementInfo + .getOrigin()).getSource(); + + tis.getElementMappings(ei.getScope().getClazz()).remove( + ei.getElementName()); + } + + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java new file mode 100644 index 00000000..e500dace --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPackageInfo.java @@ -0,0 +1,48 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.lang.StringUtils; +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; + +public class CMPackageInfo implements MPackageInfo { + + private final MPackageInfoOrigin origin; + private final String packageName; + + public CMPackageInfo(MPackageInfoOrigin origin, String packageName) { + Validate.notNull(origin); + Validate.notNull(packageName); + this.origin = origin; + this.packageName = packageName; + } + + public MPackageInfoOrigin getOrigin() { + return origin; + } + + public String getPackageName() { + return packageName; + } + + public String getPackagedName(String localName) { + if (StringUtils.isEmpty(packageName)) { + return localName; + } else { + return packageName + "." + localName; + } + } + + public String getLocalName() { + return null; + } + + public String getContainerLocalName(String delimiter) { + return null; + } + + public MPackageInfo getPackageInfo() { + return this; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java new file mode 100644 index 00000000..4b8639c1 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMPropertyInfo.java @@ -0,0 +1,57 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizable; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public abstract class CMPropertyInfo implements MPropertyInfo, + MCustomizable { + + private CMCustomizations customizations = new CMCustomizations(); + private MPropertyInfoOrigin origin; + private MClassInfo classInfo; + + private final String privateName; + + private final boolean collection; + + public CMPropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, boolean collection) { + Validate.notNull(origin); + Validate.notNull(classInfo); + Validate.notNull(privateName); + this.origin = origin; + this.classInfo = classInfo; + this.privateName = privateName; + this.collection = collection; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public MPropertyInfoOrigin getOrigin() { + return origin; + } + + public MClassInfo getClassInfo() { + return classInfo; + } + + public String getPrivateName() { + return privateName; + } + + public String getPublicName() { + // TODO + return this.getPrivateName(); + } + + public boolean isCollection() { + return collection; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java new file mode 100644 index 00000000..685cbf9a --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMSingleTypePropertyInfo.java @@ -0,0 +1,26 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MSingleTypePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public abstract class CMSingleTypePropertyInfo extends + CMPropertyInfo implements MSingleTypePropertyInfo { + + private final MTypeInfo typeInfo; + + public CMSingleTypePropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, boolean collection, + MTypeInfo typeInfo) { + super(origin, classInfo, privateName, collection); + Validate.notNull(typeInfo); + this.typeInfo = typeInfo; + } + + public MTypeInfo getTypeInfo() { + return typeInfo; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java new file mode 100644 index 00000000..f98b38b9 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMValuePropertyInfo.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMValuePropertyInfo extends CMSingleTypePropertyInfo + implements MValuePropertyInfo { + + public CMValuePropertyInfo(MPropertyInfoOrigin origin, + MClassInfo classInfo, String privateName, + MTypeInfo typeInfo) { + super(origin, classInfo, privateName, false, typeInfo); + } + + public V acceptPropertyInfoVisitor(MPropertyInfoVisitor visitor) { + return visitor.visitValuePropertyInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java new file mode 100644 index 00000000..5a477800 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/CMWildcardTypeInfo.java @@ -0,0 +1,37 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MCustomizations; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; + +public class CMWildcardTypeInfo implements MWildcardTypeInfo { + + private final T targetType; + private final MWildcardTypeInfoOrigin origin; + private final MCustomizations customizations = new CMCustomizations(); + + public CMWildcardTypeInfo(MWildcardTypeInfoOrigin origin, T targetType) { + Validate.notNull(origin); + this.origin = origin; + this.targetType = targetType; + } + + public MCustomizations getCustomizations() { + return customizations; + } + + public T getTargetType() { + return targetType; + } + + public MWildcardTypeInfoOrigin getOrigin() { + return origin; + } + + public V acceptTypeInfoVisitor(MTypeInfoVisitor visitor) { + return visitor.visitWildcardTypeInfo(this); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java new file mode 100644 index 00000000..f57e0113 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/BuiltinLeafInfoOrigin.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; + +public interface BuiltinLeafInfoOrigin> extends MSourced{ + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java new file mode 100644 index 00000000..69f4aadd --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMAnyAttributePropertyInfoOrigin.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class CMAnyAttributePropertyInfoOrigin implements MPropertyInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java new file mode 100644 index 00000000..d700c3a4 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMBuiltinLeafInfoOrigin.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MBuiltinLeafInfoOrigin; + +import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo; + +public class CMBuiltinLeafInfoOrigin> + implements MBuiltinLeafInfoOrigin, BuiltinLeafInfoOrigin { + + private final BLI source; + + public CMBuiltinLeafInfoOrigin(BLI source) { + Validate.notNull(source); + this.source = source; + } + + public BLI getSource() { + return source; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java new file mode 100644 index 00000000..602b996e --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassElementInfoOrigin.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; + +import com.sun.xml.bind.v2.model.core.ClassInfo; + +public class CMClassElementInfoOrigin> + implements MElementInfoOrigin, ClassInfoOrigin { + + private final CI source; + + public CMClassElementInfoOrigin(CI source) { + Validate.notNull(source); + this.source = source; + } + + public CI getSource() { + return source; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java new file mode 100644 index 00000000..d200488c --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMClassInfoOrigin.java @@ -0,0 +1,27 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; + +import com.sun.xml.bind.v2.model.core.ClassInfo; + +public class CMClassInfoOrigin> implements + MClassInfoOrigin, ClassInfoOrigin { + + private final CI source; + + public CMClassInfoOrigin(CI source) { + Validate.notNull(source); + this.source = source; + } + + public CI getSource() { + return source; + } + + public MElementInfoOrigin createElementInfoOrigin() { + return new CMClassElementInfoOrigin(getSource()); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java new file mode 100644 index 00000000..8ff9fa90 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMElementInfoOrigin.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; + +import com.sun.xml.bind.v2.model.core.ElementInfo; + +public class CMElementInfoOrigin> implements + MElementInfoOrigin, ElementInfoOrigin { + + private final EI source; + + public CMElementInfoOrigin(EI source) { + Validate.notNull(source); + this.source = source; + } + + public EI getSource() { + return source; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java new file mode 100644 index 00000000..cb08cf96 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumConstantInfoOrigin.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; + +import com.sun.xml.bind.v2.model.core.EnumConstant; + +public class CMEnumConstantInfoOrigin> + implements MEnumConstantInfoOrigin, EnumConstantOrigin { + + private final ECI source; + + public CMEnumConstantInfoOrigin(ECI source) { + Validate.notNull(source); + this.source = source; + } + + public ECI getSource() { + return source; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java new file mode 100644 index 00000000..21db89a1 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumElementInfoOrigin.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; + +import com.sun.xml.bind.v2.model.core.EnumLeafInfo; + +public class CMEnumElementInfoOrigin> + implements MElementInfoOrigin, EnumLeafInfoOrigin { + + private final ELI source; + + public CMEnumElementInfoOrigin(ELI source) { + Validate.notNull(source); + this.source = source; + } + + public ELI getSource() { + return source; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java new file mode 100644 index 00000000..214552e3 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMEnumLeafInfoOrigin.java @@ -0,0 +1,28 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; + +import com.sun.xml.bind.v2.model.core.EnumLeafInfo; + +public class CMEnumLeafInfoOrigin> + implements MEnumLeafInfoOrigin, EnumLeafInfoOrigin { + + private final ELI source; + + public CMEnumLeafInfoOrigin(ELI source) { + Validate.notNull(source); + this.source = source; + } + + public ELI getSource() { + return source; + } + + public MElementInfoOrigin createElementInfoOrigin() { + return new CMEnumElementInfoOrigin( + getSource()); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java new file mode 100644 index 00000000..315bd67f --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMModelInfoOrigin.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; + +import com.sun.xml.bind.v2.model.core.TypeInfoSet; + +public class CMModelInfoOrigin> + implements MModelInfoOrigin, TypeInfoSetOrigin { + + private final TIS source; + + public CMModelInfoOrigin(TIS source) { + Validate.notNull(source); + this.source = source; + } + + public TIS getSource() { + return source; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java new file mode 100644 index 00000000..3d2ccc09 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPackageInfoOrigin.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; + +public class CMPackageInfoOrigin implements MPackageInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java new file mode 100644 index 00000000..c6759068 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMPropertyInfoOrigin.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +import com.sun.xml.bind.v2.model.core.PropertyInfo; + +public class CMPropertyInfoOrigin> implements MPropertyInfoOrigin, + PropertyInfoOrigin { + + private final PI source; + + public CMPropertyInfoOrigin(PI source) { + Validate.notNull(source); + this.source = source; + } + + public PI getSource() { + return source; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java new file mode 100644 index 00000000..bcb2c148 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/CMWildcardTypeInfoOrigin.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MWildcardTypeInfoOrigin; + +import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; + +public class CMWildcardTypeInfoOrigin> + implements MWildcardTypeInfoOrigin, WildcardTypeInfoOrigin { + + private final WTI source; + + public CMWildcardTypeInfoOrigin(WTI source) { + Validate.notNull(source); + this.source = source; + } + + public WTI getSource() { + return source; + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java new file mode 100644 index 00000000..f6873a57 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ClassInfoOrigin.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.xml.bind.v2.model.core.ClassInfo; + +public interface ClassInfoOrigin> extends + MSourced { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java new file mode 100644 index 00000000..9edc45f0 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/ElementInfoOrigin.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.xml.bind.v2.model.core.ElementInfo; + +public interface ElementInfoOrigin> extends + MSourced { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java new file mode 100644 index 00000000..9a1e6713 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumConstantOrigin.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.xml.bind.v2.model.core.EnumConstant; + +public interface EnumConstantOrigin> + extends MSourced { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java new file mode 100644 index 00000000..bcd7c6b5 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/EnumLeafInfoOrigin.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.xml.bind.v2.model.core.EnumLeafInfo; + +public interface EnumLeafInfoOrigin> extends + MSourced { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java new file mode 100644 index 00000000..3fc35cb6 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/PropertyInfoOrigin.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.xml.bind.v2.model.core.PropertyInfo; + +public interface PropertyInfoOrigin> + extends MSourced { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java new file mode 100644 index 00000000..e09a7991 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/TypeInfoSetOrigin.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.xml.bind.v2.model.core.TypeInfoSet; + +public interface TypeInfoSetOrigin> + extends MSourced { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java new file mode 100644 index 00000000..bbf6ab9d --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/concrete/origin/WildcardTypeInfoOrigin.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.xml.bind.v2.model.core.WildcardTypeInfo; + +public interface WildcardTypeInfoOrigin> + extends MSourced { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java new file mode 100644 index 00000000..4bbf4f3e --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MBuiltinLeafInfoOrigin.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MBuiltinLeafInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java new file mode 100644 index 00000000..895b4224 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MClassInfoOrigin.java @@ -0,0 +1,6 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MClassInfoOrigin { + + public MElementInfoOrigin createElementInfoOrigin(); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java new file mode 100644 index 00000000..050042ba --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MElementInfoOrigin.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MElementInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java new file mode 100644 index 00000000..c13f9875 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumConstantInfoOrigin.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MEnumConstantInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java new file mode 100644 index 00000000..05c542f6 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MEnumLeafInfoOrigin.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MEnumLeafInfoOrigin { + + public MElementInfoOrigin createElementInfoOrigin(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java new file mode 100644 index 00000000..3df809c4 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MModelInfoOrigin.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MModelInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java new file mode 100644 index 00000000..48971d15 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MOriginated.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MOriginated { + + public O getOrigin(); + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java new file mode 100644 index 00000000..1d43b29b --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPackageInfoOrigin.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MPackageInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java new file mode 100644 index 00000000..f701d620 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MPropertyInfoOrigin.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MPropertyInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java new file mode 100644 index 00000000..175cd965 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/origin/MWildcardTypeInfoOrigin.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.origin; + +public interface MWildcardTypeInfoOrigin { + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java new file mode 100644 index 00000000..2d7ba0fd --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultPropertyInfoVisitor.java @@ -0,0 +1,53 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.util; + +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; + +public class DefaultPropertyInfoVisitor implements + MPropertyInfoVisitor { + + public V visitPropertyInfo(MPropertyInfo info) { + return null; + } + + public V visitElementPropertyInfo(MElementPropertyInfo info) { + return visitPropertyInfo(info); + } + + public V visitElementsPropertyInfo(MElementsPropertyInfo info) { + return visitPropertyInfo(info); + } + + public V visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { + return visitPropertyInfo(info); + } + + public V visitAttributePropertyInfo(MAttributePropertyInfo info) { + return visitPropertyInfo(info); + } + + public V visitAnyAttributePropertyInfo(MAnyAttributePropertyInfo info) { + return visitPropertyInfo(info); + } + + public V visitValuePropertyInfo(MValuePropertyInfo info) { + return visitPropertyInfo(info); + } + + public V visitElementRefPropertyInfo(MElementRefPropertyInfo info) { + return visitPropertyInfo(info); + } + + public V visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { + return visitPropertyInfo(info); + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java new file mode 100644 index 00000000..60edfb51 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/DefaultTypeInfoVisitor.java @@ -0,0 +1,57 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.util; + +import org.jvnet.jaxb2_commons.xml.bind.model.MBuiltinLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MID; +import org.jvnet.jaxb2_commons.xml.bind.model.MIDREF; +import org.jvnet.jaxb2_commons.xml.bind.model.MIDREFS; +import org.jvnet.jaxb2_commons.xml.bind.model.MList; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MWildcardTypeInfo; + +public class DefaultTypeInfoVisitor implements + MTypeInfoVisitor { + + public V visitTypeInfo(MTypeInfo typeInfo) { + return null; + } + + public V visitList(MList info) { + return visitTypeInfo(info); + } + + public V visitID(MID info) { + return visitTypeInfo(info); + } + + public V visitIDREF(MIDREF info) { + return visitTypeInfo(info); + } + + public V visitIDREFS(MIDREFS info) { + return visitTypeInfo(info); + } + + public V visitBuiltinLeafInfo(MBuiltinLeafInfo info) { + return visitTypeInfo(info); + } + + public V visitEnumLeafInfo(MEnumLeafInfo info) { + return visitTypeInfo(info); + } + + public V visitWildcardTypeInfo(MWildcardTypeInfo info) { + return visitTypeInfo(info); + } + + public V visitClassInfo(MClassInfo info) { + return visitTypeInfo(info); + } + + public V visitClassRef(MClassRef info) { + return visitTypeInfo(info); + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java new file mode 100644 index 00000000..f6d7dff7 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/PackageInfoQNameAnalyzer.java @@ -0,0 +1,115 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.util; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.StringUtils; +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +public class PackageInfoQNameAnalyzer { + + private final MModelInfo modelInfo; + + public PackageInfoQNameAnalyzer(MModelInfo modelInfo) { + Validate.notNull(modelInfo); + this.modelInfo = modelInfo; + } + + public String getMostUsedElementNamespaceURI(MPackageInfo packageInfo) { + final NamespaceURICounter counter = new NamespaceURICounter(); + final QNameCollector collector = new QNameCollector() { + + public void element(QName name) { + counter.add(name.getNamespaceURI()); + } + + public void attribute(QName name) { + + } + }; + + collectNamespaceURIs(packageInfo, collector); + return counter.getMostUsedNamespaceURI(); + } + + public String getMostUsedAttributeNamespaceURI(MPackageInfo packageInfo) { + final NamespaceURICounter counter = new NamespaceURICounter(); + final QNameCollector collector = new QNameCollector() { + + public void element(QName name) { + } + + public void attribute(QName name) { + counter.add(name.getNamespaceURI()); + } + }; + + collectNamespaceURIs(packageInfo, collector); + return counter.getMostUsedNamespaceURI(); + } + + private void collectNamespaceURIs(MPackageInfo packageInfo, + final QNameCollector collector) { + for (MElementInfo elementInfo : modelInfo.getElementInfos()) { + if (elementInfo.getPackageInfo() == packageInfo) { + collector.element(elementInfo.getElementName()); + } + } + + final QNameCollectingPropertyInfoVisitor visitor = new QNameCollectingPropertyInfoVisitor( + collector); + for (MClassInfo classInfo : modelInfo.getClassInfos()) { + if (classInfo.getPackageInfo() == packageInfo) { + for (MPropertyInfo propertyInfo : classInfo + .getProperties()) { + propertyInfo.acceptPropertyInfoVisitor(visitor); + } + } + } + } + + private static class NamespaceURICounter { + private Map map = new HashMap(); + + public void add(String namespaceURI) { + final Integer count = map.get(namespaceURI); + if (count == null) { + map.put(namespaceURI, Integer.valueOf(1)); + } else { + map.put(namespaceURI, Integer.valueOf(count.intValue() + 1)); + } + } + + public String getMostUsedNamespaceURI() { + String namespaceURI = null; + int count = 0; + + for (Map.Entry e : map.entrySet()) { + final String currentNamespaceURI = e.getKey(); + final int currentCount = e.getValue(); + if (namespaceURI == null) { + namespaceURI = currentNamespaceURI; + count = currentCount; + } else { + if (currentCount > count + || (currentCount == count && namespaceURI == null)) { + namespaceURI = currentNamespaceURI; + count = currentCount; + } + } + } + + return StringUtils.isEmpty(namespaceURI) ? null : namespaceURI; + + } + + } + +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java new file mode 100644 index 00000000..0aa54113 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollectingPropertyInfoVisitor.java @@ -0,0 +1,90 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.util; + +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; + +public class QNameCollectingPropertyInfoVisitor implements + MPropertyInfoVisitor { + + private final QNameCollector collector; + + public QNameCollectingPropertyInfoVisitor(QNameCollector collector) { + Validate.notNull(collector); + this.collector = collector; + } + + public Void visitElementPropertyInfo(MElementPropertyInfo info) { + QName wrapperElementName = info.getWrapperElementName(); + if (wrapperElementName != null) { + collector.element(wrapperElementName); + } + QName elementName = info.getElementName(); + collector.element(elementName); + return null; + } + + public Void visitElementsPropertyInfo(MElementsPropertyInfo info) { + QName wrapperElementName = info.getWrapperElementName(); + if (wrapperElementName != null) { + collector.element(wrapperElementName); + } + for (MElementTypeInfo elementTypeInfo : info + .getElementTypeInfos()) { + QName elementName = elementTypeInfo.getElementName(); + collector.element(elementName); + } + return null; + } + + public Void visitAnyElementPropertyInfo(MAnyElementPropertyInfo info) { + return null; + } + + public Void visitAttributePropertyInfo(MAttributePropertyInfo info) { + collector.attribute(info.getAttributeName()); + return null; + } + + public Void visitAnyAttributePropertyInfo( + MAnyAttributePropertyInfo info) { + return null; + } + + public Void visitValuePropertyInfo(MValuePropertyInfo info) { + return null; + } + + public Void visitElementRefPropertyInfo(MElementRefPropertyInfo info) { + QName wrapperElementName = info.getWrapperElementName(); + if (wrapperElementName != null) { + collector.element(wrapperElementName); + } + QName elementName = info.getElementName(); + collector.element(elementName); + return null; + } + + public Void visitElementRefsPropertyInfo(MElementRefsPropertyInfo info) { + QName wrapperElementName = info.getWrapperElementName(); + if (wrapperElementName != null) { + collector.element(wrapperElementName); + } + for (MElementTypeInfo elementTypeInfo : info + .getElementTypeInfos()) { + QName elementName = elementTypeInfo.getElementName(); + collector.element(elementName); + } + return null; + } +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java new file mode 100644 index 00000000..902cd911 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xml/bind/model/util/QNameCollector.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.xml.bind.model.util; + +import javax.xml.namespace.QName; + +public interface QNameCollector { + + public void element(QName name); + + public void attribute(QName name); +} diff --git a/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java b/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java new file mode 100644 index 00000000..4bcbd417 --- /dev/null +++ b/runtime/src/main/java/org/jvnet/jaxb2_commons/xmlschema/XmlSchemaConstants.java @@ -0,0 +1,107 @@ +package org.jvnet.jaxb2_commons.xmlschema; + +import javax.xml.namespace.QName; + +public class XmlSchemaConstants { + public static final String NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema"; + public static final QName ANYTYPE = xsd("anyType"); + public static final QName ANYSIMPLETYPE = xsd("anySimpleType"); + + public static final QName STRING = xsd("string"); + + public static final QName NORMALIZEDSTRING = xsd("normalizedString"); + + public static final QName TOKEN = xsd("token"); + + public static final QName LANGUAGE = xsd("language"); + + public static final QName NAME = xsd("Name"); + + public static final QName NCNAME = xsd("NCName"); + + public static final QName ID = xsd("ID"); + + public static final QName IDREF = xsd("IDREF"); + + public static final QName IDREFS = xsd("IDREFS"); + + public static final QName ENTITY = xsd("ENTITY"); + + public static final QName ENTITIES = xsd("ENTITIES"); + + public static final QName NMTOKEN = xsd("NMTOKEN"); + + public static final QName NMTOKENS = xsd("NMTOKENS"); + + public static final QName BOOLEAN = xsd("boolean"); + + public static final QName BASE64BINARY = xsd("base64Binary"); + + public static final QName HEXBINARY = xsd("hexBinary"); + + public static final QName FLOAT = xsd("float"); + + public static final QName DECIMAL = xsd("decimal"); + + public static final QName INTEGER = xsd("integer"); + + public static final QName NONPOSITIVEINTEGER = xsd("nonPositiveInteger"); + + public static final QName NEGATIVEINTEGER = xsd("negativeInteger"); + + public static final QName LONG = xsd("long"); + + public static final QName INT = xsd("int"); + + public static final QName SHORT = xsd("short"); + + public static final QName BYTE = xsd("byte"); + + public static final QName NONNEGATIVEINTEGER = xsd("nonNegativeInteger"); + + public static final QName UNSIGNEDLONG = xsd("unsignedLong"); + + public static final QName UNSIGNEDINT = xsd("unsignedInt"); + + public static final QName UNSIGNEDSHORT = xsd("unsignedShort"); + + public static final QName UNSIGNEDBYTE = xsd("unsignedByte"); + + public static final QName POSITIVEINTEGER = xsd("positiveInteger"); + + public static final QName DOUBLE = xsd("double"); + + public static final QName ANYURI = xsd("anyURI"); + + public static final QName QNAME = xsd("QName"); + + public static final QName NOTATION = xsd("NOTATION"); + + public static final QName DURATION = xsd("duration"); + + public static final QName DATETIME = xsd("dateTime"); + public static final QName TIME = xsd("time"); + public static final QName DATE = xsd("date"); + public static final QName GYEARMONTH = xsd("gYearMonth"); + public static final QName GYEAR = xsd("gYear"); + public static final QName GMONTHDAY = xsd("gMonthDay"); + public static final QName GDAY = xsd("gDay"); + public static final QName GMONTH = xsd("gMonth"); + + public static final QName CALENDAR = xsd("\u0000"); + + public static final QName[] TYPE_NAMES = new QName[] { ANYTYPE, + ANYSIMPLETYPE, STRING, NORMALIZEDSTRING, TOKEN, LANGUAGE, NAME, + NCNAME, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, + BOOLEAN, BASE64BINARY, HEXBINARY, FLOAT, DECIMAL, INTEGER, + NONPOSITIVEINTEGER, NEGATIVEINTEGER, LONG, INT, SHORT, BYTE, + NONNEGATIVEINTEGER, UNSIGNEDLONG, UNSIGNEDINT, UNSIGNEDSHORT, + UNSIGNEDBYTE, POSITIVEINTEGER, DOUBLE, ANYURI, QNAME, NOTATION, + DURATION, DATETIME, TIME, DATE, GYEARMONTH, GYEAR, GMONTHDAY, GDAY, + GMONTH, CALENDAR }; + + public static QName xsd(String localPart) { + return new QName(NAMESPACE_URI, localPart, "xsd"); + } + +} diff --git a/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties b/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties new file mode 100644 index 00000000..53504a6b --- /dev/null +++ b/runtime/src/main/resources/org/jvnet/jaxb2_commons/locator/messages.properties @@ -0,0 +1,10 @@ +org.jvnet.jaxbcommons.locator.DefaultRootObjectLocator = \ +Object: {0}. + +org.jvnet.jaxbcommons.locator.DefaultPropertyObjectLocator = \ +Property name: {1}.\n\ +Property value: {0}. + +org.jvnet.jaxbcommons.locator.DefaultItemObjectLocator = \ +Item index: {1}.\n\ +Item value: {0}. \ No newline at end of file diff --git a/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java b/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java new file mode 100644 index 00000000..d1f9f465 --- /dev/null +++ b/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CopyStrategyTest.java @@ -0,0 +1,89 @@ +package org.jvnet.jaxb2_commons.lang.tests; + +import java.io.InputStream; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlRootElement; + +import junit.framework.TestCase; + +import org.apache.commons.io.IOUtils; +import org.jvnet.jaxb2_commons.lang.CopyStrategy; +import org.jvnet.jaxb2_commons.lang.CopyTo; +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.Polygon; + +public class CopyStrategyTest extends TestCase { + + public void testPolygon() { + final GeometryFactory geometryFactory = new GeometryFactory(); + final Polygon polygon = geometryFactory.createPolygon( + geometryFactory.createLinearRing(new Coordinate[] { + new Coordinate(0, 0, 0), new Coordinate(1, 1, 0), + + new Coordinate(1, 0, 0), new Coordinate(0, 1, 0), + new Coordinate(0, 0, 0) }), null); + + polygon.clone(); + + new JAXBCopyStrategy().copy(null, polygon); + + } + + public void testAny() throws Exception { + JAXBContext context = JAXBContext.newInstance(A.class); + + final InputStream is = getClass().getResourceAsStream("Test[0].xml"); + try { + A a = (A) context.createUnmarshaller().unmarshal(is); + + a.copyTo(a.createNewInstance()); + } finally { + IOUtils.closeQuietly(is); + } + } + + @XmlRootElement(name = "a") + @XmlAccessorType(XmlAccessType.FIELD) + public static class A implements CopyTo { + @XmlAnyElement(lax = true) + private Object any; + + public Object getAny() { + return any; + } + + public void setAny(Object any) { + this.any = any; + } + + public Object createNewInstance() { + return new A(); + } + + public Object copyTo(Object target) { + return copyTo(null, target, JAXBCopyStrategy.INSTANCE); + } + + public Object copyTo(ObjectLocator locator, Object target, + CopyStrategy copyStrategy) { + final A copy = ((target == null) ? ((A) createNewInstance()) + : ((A) target)); + { + Object sourceAny; + sourceAny = this.getAny(); + Object copyAny = ((Object) copyStrategy.copy(null, sourceAny)); + copy.setAny(copyAny); + } + return copy; + } + + } +} diff --git a/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java b/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java new file mode 100644 index 00000000..d932fedd --- /dev/null +++ b/runtime/src/test/java/org/jvnet/jaxb2_commons/lang/tests/CyclicTests.java @@ -0,0 +1,94 @@ +package org.jvnet.jaxb2_commons.lang.tests; + +import java.util.IdentityHashMap; +import java.util.Map; + +import junit.framework.TestCase; + +import org.jvnet.jaxb2_commons.lang.CopyStrategy; +import org.jvnet.jaxb2_commons.lang.CopyTo; +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.locator.DefaultRootObjectLocator; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; + +public class CyclicTests extends TestCase { + + public interface CopyToInstance extends CopyTo { + } + + public static class A implements CopyToInstance { + public B b; + + public Object createNewInstance() { + return new A(); + } + + public Object copyTo(Object target) { + return copyTo(null, target, JAXBCopyStrategy.INSTANCE); + } + + public Object copyTo(ObjectLocator locator, Object target, + CopyStrategy copyStrategy) { + final A that = (A) target; + that.b = (B) copyStrategy.copy(LocatorUtils.property(locator, "b", + this.b), this.b); + return that; + } + + } + + public static class B implements CopyToInstance { + public A a; + + public Object createNewInstance() { + return new B(); + } + + public Object copyTo(Object target) { + return copyTo(null, target, JAXBCopyStrategy.INSTANCE); + } + + public Object copyTo(ObjectLocator locator, Object target, + CopyStrategy copyStrategy) { + final B that = (B) target; + that.a = (A) copyStrategy.copy(LocatorUtils.property(locator, "a", + this.a), this.a); + return that; + } + } + + public void testCycle() throws Exception { + final A a = new A(); + final B b = new B(); + a.b = b; + b.a = a; + + final A a1 = (A) new JAXBCopyStrategy() { + private Map copies = new IdentityHashMap(); + + @Override + public Object copy(ObjectLocator locator, Object object) { + final Object existingCopy = copies.get(object); + if (existingCopy != null) { + return existingCopy; + } else { + if (object instanceof CopyToInstance) { + final CopyToInstance source = (CopyToInstance) object; + final Object newCopy = source.createNewInstance(); + copies.put(object, newCopy); + source.copyTo(locator, newCopy, this); + return newCopy; + } else { + final Object newCopy = super.copy(locator, object); + copies.put(object, newCopy); + return newCopy; + } + } + } + }.copy(new DefaultRootObjectLocator(a), a); + + assertSame(a1.b.a, a1); + } + +} diff --git a/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml b/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml new file mode 100644 index 00000000..42a4f94f --- /dev/null +++ b/runtime/src/test/resources/org/jvnet/jaxb2_commons/lang/tests/Test[0].xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/basics/trunk/samples/basic/pom.xml b/samples/basic/pom.xml similarity index 100% rename from basics/trunk/samples/basic/pom.xml rename to samples/basic/pom.xml diff --git a/basics/tags/0.7.0/samples/basic/project-build.xml b/samples/basic/project-build.xml similarity index 100% rename from basics/tags/0.7.0/samples/basic/project-build.xml rename to samples/basic/project-build.xml diff --git a/basics/tags/0.6.4/samples/basic/project-pom.xml b/samples/basic/project-pom.xml similarity index 100% rename from basics/tags/0.6.4/samples/basic/project-pom.xml rename to samples/basic/project-pom.xml diff --git a/samples/basic/src/main/assembly/src.xml b/samples/basic/src/main/assembly/src.xml new file mode 100644 index 00000000..2c32578d --- /dev/null +++ b/samples/basic/src/main/assembly/src.xml @@ -0,0 +1,19 @@ + + src + + zip + + + + + README* + LICENSE* + NOTICE* + *.xml + + + + src + + + diff --git a/basics/tags/0.6.1/samples/basic/src/main/java/.placeholder b/samples/basic/src/main/java/.placeholder similarity index 100% rename from basics/tags/0.6.1/samples/basic/src/main/java/.placeholder rename to samples/basic/src/main/java/.placeholder diff --git a/samples/basic/src/main/resources/schema.xsd b/samples/basic/src/main/resources/schema.xsd new file mode 100644 index 00000000..b16a1b07 --- /dev/null +++ b/samples/basic/src/main/resources/schema.xsd @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java new file mode 100644 index 00000000..ec14ea0a --- /dev/null +++ b/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import junit.framework.Assert; + +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class CopyableTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object object = createContext().createUnmarshaller().unmarshal( + sample); + final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); + Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); + } + +} diff --git a/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java new file mode 100644 index 00000000..ac2dbc9b --- /dev/null +++ b/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class EqualsTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object lhs = createContext().createUnmarshaller().unmarshal(sample); + final Object rhs = createContext().createUnmarshaller().unmarshal(sample); + assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); + } +} diff --git a/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java new file mode 100644 index 00000000..7aa6b233 --- /dev/null +++ b/samples/basic/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; +import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; + +public class ToStringTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object object = createContext().createUnmarshaller().unmarshal(sample); + logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); + } + +} diff --git a/samples/basic/src/test/resources/log4j.properties b/samples/basic/src/test/resources/log4j.properties new file mode 100644 index 00000000..9c985635 --- /dev/null +++ b/samples/basic/src/test/resources/log4j.properties @@ -0,0 +1,5 @@ +log4j.rootCategory=DEBUG, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.target=system.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/samples/basic/src/test/samples/1.xml b/samples/basic/src/test/samples/1.xml new file mode 100644 index 00000000..ea9f06b9 --- /dev/null +++ b/samples/basic/src/test/samples/1.xml @@ -0,0 +1,11 @@ + + a + b + c + d + e + + 0 + 1 + + diff --git a/basics/tags/0.6.4/samples/modular-ant/pom.xml b/samples/modular-ant/pom.xml similarity index 100% rename from basics/tags/0.6.4/samples/modular-ant/pom.xml rename to samples/modular-ant/pom.xml diff --git a/basics/tags/0.6.4/samples/modular-ant/project-build.xml b/samples/modular-ant/project-build.xml similarity index 100% rename from basics/tags/0.6.4/samples/modular-ant/project-build.xml rename to samples/modular-ant/project-build.xml diff --git a/samples/modular-ant/src/main/assembly/src.xml b/samples/modular-ant/src/main/assembly/src.xml new file mode 100644 index 00000000..037bde98 --- /dev/null +++ b/samples/modular-ant/src/main/assembly/src.xml @@ -0,0 +1,24 @@ + + src + + zip + + + + + README* + LICENSE* + NOTICE* + build.xml + + + + src + + + + + lib + + + diff --git a/basics/tags/0.6.1/samples/modular-ant/src/main/java/.placeholder b/samples/modular-ant/src/main/java/.placeholder similarity index 100% rename from basics/tags/0.6.1/samples/modular-ant/src/main/java/.placeholder rename to samples/modular-ant/src/main/java/.placeholder diff --git a/samples/modular-ant/src/main/resources/schema.xsd b/samples/modular-ant/src/main/resources/schema.xsd new file mode 100644 index 00000000..b16a1b07 --- /dev/null +++ b/samples/modular-ant/src/main/resources/schema.xsd @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java new file mode 100644 index 00000000..ec14ea0a --- /dev/null +++ b/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import junit.framework.Assert; + +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class CopyableTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object object = createContext().createUnmarshaller().unmarshal( + sample); + final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); + Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); + } + +} diff --git a/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java new file mode 100644 index 00000000..ac2dbc9b --- /dev/null +++ b/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class EqualsTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object lhs = createContext().createUnmarshaller().unmarshal(sample); + final Object rhs = createContext().createUnmarshaller().unmarshal(sample); + assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); + } +} diff --git a/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java new file mode 100644 index 00000000..7aa6b233 --- /dev/null +++ b/samples/modular-ant/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; +import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; + +public class ToStringTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object object = createContext().createUnmarshaller().unmarshal(sample); + logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); + } + +} diff --git a/samples/modular-ant/src/test/resources/log4j.properties b/samples/modular-ant/src/test/resources/log4j.properties new file mode 100644 index 00000000..9c985635 --- /dev/null +++ b/samples/modular-ant/src/test/resources/log4j.properties @@ -0,0 +1,5 @@ +log4j.rootCategory=DEBUG, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.target=system.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/samples/modular-ant/src/test/samples/1.xml b/samples/modular-ant/src/test/samples/1.xml new file mode 100644 index 00000000..ea9f06b9 --- /dev/null +++ b/samples/modular-ant/src/test/samples/1.xml @@ -0,0 +1,11 @@ + + a + b + c + d + e + + 0 + 1 + + diff --git a/basics/trunk/samples/po/pom.xml b/samples/po/pom.xml similarity index 100% rename from basics/trunk/samples/po/pom.xml rename to samples/po/pom.xml diff --git a/basics/tags/0.7.0/samples/po/project-build.xml b/samples/po/project-build.xml similarity index 100% rename from basics/tags/0.7.0/samples/po/project-build.xml rename to samples/po/project-build.xml diff --git a/basics/tags/0.6.2/samples/po/project-pom.xml b/samples/po/project-pom.xml similarity index 100% rename from basics/tags/0.6.2/samples/po/project-pom.xml rename to samples/po/project-pom.xml diff --git a/basics/tags/0.6.1/samples/po/src/main/java/.placeholder b/samples/po/src/main/java/.placeholder similarity index 100% rename from basics/tags/0.6.1/samples/po/src/main/java/.placeholder rename to samples/po/src/main/java/.placeholder diff --git a/samples/po/src/main/resources/bindings.xjb b/samples/po/src/main/resources/bindings.xjb new file mode 100644 index 00000000..115c5a0e --- /dev/null +++ b/samples/po/src/main/resources/bindings.xjb @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/samples/po/src/main/resources/purchaseorder.xsd b/samples/po/src/main/resources/purchaseorder.xsd new file mode 100644 index 00000000..b393dab8 --- /dev/null +++ b/samples/po/src/main/resources/purchaseorder.xsd @@ -0,0 +1,66 @@ + + + + + Purchase order schema for Example.com. + Copyright 2000 Example.com. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java b/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java new file mode 100644 index 00000000..5dbedbc4 --- /dev/null +++ b/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/CopyableTest.java @@ -0,0 +1,22 @@ +package org.jvnet.jaxb2_commons.tests.po; + +import java.io.File; + +import junit.framework.Assert; + +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class CopyableTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object object = createContext().createUnmarshaller().unmarshal( + sample); + final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, object); + Assert.assertTrue("Source and copy must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, object, copy)); + } + +} diff --git a/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java b/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java new file mode 100644 index 00000000..c7194a6f --- /dev/null +++ b/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/EqualsTest.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.tests.po; + +import java.io.File; + +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class EqualsTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object lhs = createContext().createUnmarshaller().unmarshal(sample); + final Object rhs = createContext().createUnmarshaller().unmarshal(sample); + assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); + } +} diff --git a/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java b/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java new file mode 100644 index 00000000..fb8cb6be --- /dev/null +++ b/samples/po/src/test/java/org/jvnet/jaxb2_commons/tests/po/ToStringTest.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.tests.po; + +import java.io.File; + +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; +import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; + +public class ToStringTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object object = createContext().createUnmarshaller().unmarshal(sample); + logger.debug(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); + } + +} diff --git a/samples/po/src/test/resources/log4j.properties b/samples/po/src/test/resources/log4j.properties new file mode 100644 index 00000000..9c985635 --- /dev/null +++ b/samples/po/src/test/resources/log4j.properties @@ -0,0 +1,5 @@ +log4j.rootCategory=DEBUG, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.target=system.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/samples/po/src/test/samples/po.xml b/samples/po/src/test/samples/po.xml new file mode 100644 index 00000000..9449e6b4 --- /dev/null +++ b/samples/po/src/test/samples/po.xml @@ -0,0 +1,31 @@ + + + Alice Smith + 123 Maple Street + Mill Valley + CA + 90952 + + + Robert Smith + 8 Oak Avenue + Old Town + PA + 95819 + + Hurry, my lawn is going wild! + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 1 + 39.98 + 1999-05-21 + + + \ No newline at end of file diff --git a/basics/trunk/samples/pom.xml b/samples/pom.xml similarity index 100% rename from basics/trunk/samples/pom.xml rename to samples/pom.xml diff --git a/samples/src/main/assembly/ant-src.xml b/samples/src/main/assembly/ant-src.xml new file mode 100644 index 00000000..9b6bbd13 --- /dev/null +++ b/samples/src/main/assembly/ant-src.xml @@ -0,0 +1,30 @@ + + ant-src + + zip + + + + + README* + LICENSE* + NOTICE* + build.xml + + + + src + + + + + lib + + + + + ${basedir}/project-build.xml + build.xml + + + diff --git a/samples/src/main/assembly/maven-src.xml b/samples/src/main/assembly/maven-src.xml new file mode 100644 index 00000000..c65c505c --- /dev/null +++ b/samples/src/main/assembly/maven-src.xml @@ -0,0 +1,31 @@ + + maven-src + + zip + + + + + README* + LICENSE* + NOTICE* + + + + src + + + a + + + b + + + + + ${basedir}/project-pom.xml + pom.xml + true + + + diff --git a/testing/.classpath b/testing/.classpath new file mode 100644 index 00000000..bc5aeac5 --- /dev/null +++ b/testing/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/basics/tags/0.6.4/testing/.project b/testing/.project similarity index 100% rename from basics/tags/0.6.4/testing/.project rename to testing/.project diff --git a/testing/.settings/org.eclipse.core.resources.prefs b/testing/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..f9fe3459 --- /dev/null +++ b/testing/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/testing/.settings/org.eclipse.jdt.core.prefs b/testing/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..60105c1b --- /dev/null +++ b/testing/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/trunk/testing/pom.xml b/testing/pom.xml similarity index 100% rename from basics/trunk/testing/pom.xml rename to testing/pom.xml diff --git a/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java b/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java new file mode 100644 index 00000000..4287b8a6 --- /dev/null +++ b/testing/src/main/java/org/jvnet/jaxb2_commons/lang/ExtendedJAXBEqualsStrategy.java @@ -0,0 +1,45 @@ +package org.jvnet.jaxb2_commons.lang; + +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.transform.dom.DOMSource; + +import org.custommonkey.xmlunit.Diff; +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; +import org.w3c.dom.Node; + +public class ExtendedJAXBEqualsStrategy extends JAXBEqualsStrategy { + + @Override + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object lhs, Object rhs) { + + if (lhs instanceof Node && rhs instanceof Node) { + return equalsInternal(leftLocator, rightLocator, (Node) lhs, + (Node) rhs); + } else if (lhs instanceof XMLGregorianCalendar + && rhs instanceof XMLGregorianCalendar) { + return equalsInternal(leftLocator, rightLocator, + (XMLGregorianCalendar) lhs, (XMLGregorianCalendar) rhs); + + } else { + return super.equalsInternal(leftLocator, rightLocator, lhs, rhs); + } + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, XMLGregorianCalendar left, + XMLGregorianCalendar right) { + return equals(leftLocator, rightLocator, left.normalize() + .toGregorianCalendar().getTimeInMillis(), right.normalize() + .toGregorianCalendar().getTimeInMillis()); + } + + protected boolean equalsInternal(ObjectLocator leftLocator, + ObjectLocator rightLocator, Node lhs, Node rhs) { + final Diff diff = new Diff(new DOMSource((Node) lhs), new DOMSource( + (Node) rhs)); + return diff.identical(); + } + +} diff --git a/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java b/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java new file mode 100644 index 00000000..b4de9a52 --- /dev/null +++ b/testing/src/main/java/org/jvnet/jaxb2_commons/test/AbstractSamplesTest.java @@ -0,0 +1,106 @@ +package org.jvnet.jaxb2_commons.test; + +import java.io.File; +import java.util.Collection; +import java.util.Map; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public abstract class AbstractSamplesTest extends TestCase { + + protected Log logger = LogFactory.getLog(getTestClass()); + + protected String getContextPath() { + return getTestClass().getPackage().getName(); + } + + protected abstract void checkSample(File sample) throws Exception; + + public void testSamples() throws Exception { + logger.debug("Testing samples."); + int failed = 0; + final File[] sampleFiles = getSampleFiles(); + for (final File sampleFile : sampleFiles) { + logger.debug("Testing sample [" + sampleFile.getName() + "]."); + try { + checkSample(sampleFile); + } catch (Throwable ex) { + logger.error("Sample [" + sampleFile.getName() + + "] failed the check.", ex); + failed++; + } + logger.debug("Finished testing sample [" + sampleFile.getName() + + "]."); + } + logger.debug("Finished testing samples."); + + Assert.assertTrue("Totally [" + failed + "/" + sampleFiles.length + + "] failed the check.", failed == 0); + } + + protected File getBaseDir() { + try { + return (new File(getTestClass().getProtectionDomain() + .getCodeSource().getLocation().getFile())).getParentFile() + .getParentFile().getAbsoluteFile(); + } catch (Exception ex) { + throw new AssertionError(ex); + } + } + + protected Class getTestClass() { + return getClass(); + } + + protected File getSamplesDirectory() { + return new File(getBaseDir(), getSamplesDirectoryName()); + } + + public static final String DEFAULT_SAMPLES_DIRECTORY_NAME = "src/test/samples"; + + protected String getSamplesDirectoryName() { + return DEFAULT_SAMPLES_DIRECTORY_NAME; + } + + @SuppressWarnings("unchecked") + protected File[] getSampleFiles() { + File samplesDirectory = getSamplesDirectory(); + logger.debug("Sample directory [" + samplesDirectory.getAbsolutePath() + + "]."); + final Collection files = FileUtils.listFiles(samplesDirectory, + new String[] { "xml" }, true); + return files.toArray(new File[files.size()]); + } + + protected ClassLoader getContextClassLoader() { + return getTestClass().getClassLoader(); + } + + protected Map getContextProperties() { + return null; + } + + public JAXBContext createContext() throws JAXBException { + final String contextPath = getContextPath(); + final ClassLoader classLoader = getContextClassLoader(); + final Map properties = getContextProperties(); + if (classLoader == null) { + return JAXBContext.newInstance(contextPath); + } else { + if (properties == null) { + return JAXBContext.newInstance(contextPath, classLoader); + } else { + return JAXBContext.newInstance(contextPath, classLoader, + properties); + } + } + } +} \ No newline at end of file diff --git a/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java b/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java new file mode 100644 index 00000000..613f81ed --- /dev/null +++ b/testing/src/test/java/org/jvnet/jaxb2_commons/test/tests/TrivialSamplesTest.java @@ -0,0 +1,14 @@ +package org.jvnet.jaxb2_commons.test.tests; + +import java.io.File; + +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class TrivialSamplesTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + assertTrue("Wrong extension.", sample.getName().endsWith(".xml")); + } + +} diff --git a/basics/tags/0.6.1/testing/src/test/samples/1.xml b/testing/src/test/samples/1.xml similarity index 100% rename from basics/tags/0.6.1/testing/src/test/samples/1.xml rename to testing/src/test/samples/1.xml diff --git a/basics/tags/0.6.1/testing/src/test/samples/2.xml b/testing/src/test/samples/2.xml similarity index 100% rename from basics/tags/0.6.1/testing/src/test/samples/2.xml rename to testing/src/test/samples/2.xml diff --git a/tests/build-1.5.bat b/tests/build-1.5.bat new file mode 100644 index 00000000..2e54b58b --- /dev/null +++ b/tests/build-1.5.bat @@ -0,0 +1,4 @@ +setlocal +set JAVA_HOME=%JAVA5_HOME% +call mvn clean install >std 2>err +endlocal \ No newline at end of file diff --git a/tests/build-1.6.bat b/tests/build-1.6.bat new file mode 100644 index 00000000..27d512c9 --- /dev/null +++ b/tests/build-1.6.bat @@ -0,0 +1,4 @@ +setlocal +set JAVA_HOME=%JAVA6_HOME% +call mvn clean install >std 2>err +endlocal \ No newline at end of file diff --git a/basics/trunk/tests/episodes/a/pom.xml b/tests/episodes/a/pom.xml similarity index 100% rename from basics/trunk/tests/episodes/a/pom.xml rename to tests/episodes/a/pom.xml diff --git a/tests/episodes/a/src/main/resources/a.xsd b/tests/episodes/a/src/main/resources/a.xsd new file mode 100644 index 00000000..51d4ee39 --- /dev/null +++ b/tests/episodes/a/src/main/resources/a.xsd @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/episodes/a/src/main/resources/binding.xjb b/tests/episodes/a/src/main/resources/binding.xjb new file mode 100644 index 00000000..d5a94e1b --- /dev/null +++ b/tests/episodes/a/src/main/resources/binding.xjb @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/tests/episodes/a/src/test/samples/1.xml b/tests/episodes/a/src/test/samples/1.xml new file mode 100644 index 00000000..da8a7247 --- /dev/null +++ b/tests/episodes/a/src/test/samples/1.xml @@ -0,0 +1,5 @@ + + + test + + \ No newline at end of file diff --git a/basics/trunk/tests/episodes/b/pom.xml b/tests/episodes/b/pom.xml similarity index 100% rename from basics/trunk/tests/episodes/b/pom.xml rename to tests/episodes/b/pom.xml diff --git a/tests/episodes/b/src/main/resources/a.xsd b/tests/episodes/b/src/main/resources/a.xsd new file mode 100644 index 00000000..51d4ee39 --- /dev/null +++ b/tests/episodes/b/src/main/resources/a.xsd @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/episodes/b/src/main/resources/b.xsd b/tests/episodes/b/src/main/resources/b.xsd new file mode 100644 index 00000000..0b45601e --- /dev/null +++ b/tests/episodes/b/src/main/resources/b.xsd @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/episodes/b/src/main/resources/binding.xjb b/tests/episodes/b/src/main/resources/binding.xjb new file mode 100644 index 00000000..4725321b --- /dev/null +++ b/tests/episodes/b/src/main/resources/binding.xjb @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/tests/episodes/b/src/test/samples/1.xml b/tests/episodes/b/src/test/samples/1.xml new file mode 100644 index 00000000..3922598a --- /dev/null +++ b/tests/episodes/b/src/test/samples/1.xml @@ -0,0 +1,8 @@ + + + test + + + test + + \ No newline at end of file diff --git a/basics/trunk/tests/episodes/pom.xml b/tests/episodes/pom.xml similarity index 100% rename from basics/trunk/tests/episodes/pom.xml rename to tests/episodes/pom.xml diff --git a/basics/tags/0.8.0/tests/ignoring/pom.xml b/tests/ignoring/pom.xml similarity index 100% rename from basics/tags/0.8.0/tests/ignoring/pom.xml rename to tests/ignoring/pom.xml diff --git a/tests/ignoring/src/main/resources/schema.xsd b/tests/ignoring/src/main/resources/schema.xsd new file mode 100644 index 00000000..fadf2bdf --- /dev/null +++ b/tests/ignoring/src/main/resources/schema.xsd @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/issues/.classpath b/tests/issues/.classpath new file mode 100644 index 00000000..278f68ed --- /dev/null +++ b/tests/issues/.classpath @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/basics/tags/0.8.0/tests/issues/.project b/tests/issues/.project similarity index 100% rename from basics/tags/0.8.0/tests/issues/.project rename to tests/issues/.project diff --git a/basics/trunk/tests/issues/pom.xml b/tests/issues/pom.xml similarity index 100% rename from basics/trunk/tests/issues/pom.xml rename to tests/issues/pom.xml diff --git a/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java new file mode 100644 index 00000000..35f45148 --- /dev/null +++ b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseClass.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +public class IssueJIIB14BaseClass { + +} diff --git a/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java new file mode 100644 index 00000000..6259564b --- /dev/null +++ b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceFour.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +public interface IssueJIIB14BaseInterfaceFour { + +} diff --git a/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java new file mode 100644 index 00000000..bf70dc85 --- /dev/null +++ b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceOne.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +public interface IssueJIIB14BaseInterfaceOne { + +} diff --git a/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java new file mode 100644 index 00000000..404b5070 --- /dev/null +++ b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceThree.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +public interface IssueJIIB14BaseInterfaceThree { + +} diff --git a/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java new file mode 100644 index 00000000..a273137b --- /dev/null +++ b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB14BaseInterfaceTwo.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +public interface IssueJIIB14BaseInterfaceTwo { + +} diff --git a/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java new file mode 100644 index 00000000..a9b8d3a7 --- /dev/null +++ b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB42EqualsStrategy.java @@ -0,0 +1,18 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; + +public class IssueJIIB42EqualsStrategy extends JAXBEqualsStrategy { + + @Override + public boolean equals(ObjectLocator leftLocator, + ObjectLocator rightLocator, Object lhs, Object rhs) { + if (lhs instanceof IssueJIIB1Type && rhs instanceof IssueJIIB1Type) { + // Quasi custom equals + return super.equals(leftLocator, rightLocator, lhs, rhs); + } else { + return super.equals(leftLocator, rightLocator, lhs, rhs); + } + } +} diff --git a/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java new file mode 100644 index 00000000..1339edc6 --- /dev/null +++ b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB48Interface.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +public interface IssueJIIB48Interface { + + public T getValue(); + +} diff --git a/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java new file mode 100644 index 00000000..9dc324d4 --- /dev/null +++ b/tests/issues/src/main/java/org/jvnet/jaxb2_commons/tests/issues/IssueJIIB53ABaseClass.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +public class IssueJIIB53ABaseClass { + +} diff --git a/tests/issues/src/main/resources/binding.xjb b/tests/issues/src/main/resources/binding.xjb new file mode 100644 index 00000000..ce90efc4 --- /dev/null +++ b/tests/issues/src/main/resources/binding.xjb @@ -0,0 +1,18 @@ + + + + + java.lang.Cloneable + + + + java.lang.Cloneable + + + diff --git a/tests/issues/src/main/resources/schema.xsd b/tests/issues/src/main/resources/schema.xsd new file mode 100644 index 00000000..a7d3962d --- /dev/null +++ b/tests/issues/src/main/resources/schema.xsd @@ -0,0 +1,336 @@ + + + + + + + + + + + + + + java.lang.Cloneable + + + + + + + + + + + + + + + + + + java.lang.Cloneable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.jvnet.jaxb2_commons.tests.issues.IssueJIIB48Interface<java.lang.String> + + + + + + + + + + + org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53ABaseClass + + + + + + + + + + + org.jvnet.jaxb2_commons.tests.issues.IssueJIIB53AType + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java new file mode 100644 index 00000000..7a4bfb48 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/CopyableTest.java @@ -0,0 +1,27 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import java.io.File; + +import junit.framework.Assert; + +import org.jvnet.jaxb2_commons.lang.CopyStrategy; +import org.jvnet.jaxb2_commons.lang.EqualsStrategy; +import org.jvnet.jaxb2_commons.lang.ExtendedJAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class CopyableTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object original = createContext().createUnmarshaller().unmarshal( + sample); + final CopyStrategy copyStrategy = new JAXBCopyStrategy(); + final Object copy = copyStrategy.copy(null, original); + final EqualsStrategy equalsStrategy = new ExtendedJAXBEqualsStrategy(); + Assert.assertTrue("Source and copy must be equal.", equalsStrategy + .equals(null, null, original, copy)); + } + +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java new file mode 100644 index 00000000..9b8e1d85 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB10Test.java @@ -0,0 +1,19 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import java.lang.reflect.Field; + +import javax.xml.bind.annotation.XmlAnyElement; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class JIIB10Test extends TestCase { + + public void testXmlAnyElementLax() throws Exception { + + final Field contentField = IssueJIIB10Type.class.getDeclaredField("content"); + final XmlAnyElement xmlAnyElementAnnotation = contentField + .getAnnotation(XmlAnyElement.class); + Assert.assertTrue(xmlAnyElementAnnotation.lax()); + } +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java new file mode 100644 index 00000000..5b5249d2 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB14Test.java @@ -0,0 +1,20 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class JIIB14Test extends TestCase { + + public void testIssueJIIB14() throws Exception { + Assert.assertEquals(IssueJIIB14BaseClass.class, + IssueJIIB14Element.class.getSuperclass()); + Assert.assertTrue(IssueJIIB14BaseInterfaceOne.class + .isAssignableFrom(IssueJIIB14Element.class)); + Assert.assertTrue(IssueJIIB14BaseInterfaceTwo.class + .isAssignableFrom(IssueJIIB14Element.class)); + Assert.assertTrue(IssueJIIB14BaseInterfaceThree.class + .isAssignableFrom(IssueJIIB14JAXBElement.class)); + Assert.assertTrue(IssueJIIB14BaseInterfaceFour.class + .isAssignableFrom(IssueJIIB14JAXBElement.class)); + } +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java new file mode 100644 index 00000000..1c63d5d8 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB20Test.java @@ -0,0 +1,20 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import java.util.Arrays; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class JIIB20Test extends TestCase { + + public void testException() throws Exception { + + final List strings = Arrays.asList("a", "b", "c"); + final IssueJIIB20 one = new IssueJIIB20(); + one.setStrings(strings); + Assert.assertEquals(strings, one.getStrings()); + Assert.assertSame(strings, one.getStrings()); + + } +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java new file mode 100644 index 00000000..0ea33da3 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB35Test.java @@ -0,0 +1,36 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import javax.xml.bind.JAXBContext; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.jvnet.jaxb2_commons.lang.ContextUtils; + +public class JIIB35Test extends TestCase { + + public void testException() throws Exception { + + final ObjectFactory objectFactory = new ObjectFactory(); + + final IssueJIIB35 one = objectFactory.createIssueJIIB35(); + final IssueJIIB35 two = objectFactory.createIssueJIIB35(); + final IssueJIIB35 three = objectFactory.createIssueJIIB35(); + final IssueJIIB35 four = objectFactory.createIssueJIIB35(); + + final JAXBContext context = JAXBContext.newInstance(IssueJIIB35.class); + + final String alpha = ContextUtils.toString(context, one); + two.hashCode(); + final String beta = ContextUtils.toString(context, two); + three.equals(null); + final String gamma = ContextUtils.toString(context, three); + four.toString(); + final String delta = ContextUtils.toString(context, four); + + Assert.assertEquals(alpha, beta); + Assert.assertEquals(beta, gamma); + Assert.assertEquals(gamma, delta); + + } +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java new file mode 100644 index 00000000..4d9f3658 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java @@ -0,0 +1,18 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class JIIB36Test extends TestCase { + + public void testException() throws Exception { + + final IssueJIIB36 one = new IssueJIIB36(); + final IssueJIIB36 two = new IssueJIIB36(); + + Assert.assertTrue(one.equals(two)); + Assert.assertTrue(two.equals(one)); + Assert.assertEquals(one.hashCode(), two.hashCode()); + + } +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java new file mode 100644 index 00000000..f162a023 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB38Test.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class JIIB38Test extends TestCase { + + public void testException() throws Exception { + + final IssueJIIB38 one = new IssueJIIB38(); + final IssueJIIB38Type two = IssueJIIB38Type.A; + + Assert.assertTrue(one instanceof Cloneable); + Assert.assertTrue(two instanceof Cloneable); + + } +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java new file mode 100644 index 00000000..a62de206 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB44Test.java @@ -0,0 +1,51 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class JIIB44Test extends TestCase { + + private JAXBContext context; + + @Override + protected void setUp() throws Exception { + context = JAXBContext.newInstance(getClass().getPackage().getName()); + } + + public void testReferencesPropertyAsElementPropertyType() throws Exception { + + IssueJIIB44ReferencesPropertyAsElementPropertyType value = ((JAXBElement) context + .createUnmarshaller().unmarshal( + getClass().getResourceAsStream("issueJIIB44_0.xml"))) + .getValue(); + + Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); + Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); + } + + public void testReferencesPropertyAsReferencePropertyType() + throws Exception { + + IssueJIIB44ReferencesPropertyAsReferencePropertyType value = ((JAXBElement) context + .createUnmarshaller().unmarshal( + getClass().getResourceAsStream("issueJIIB44_1.xml"))) + .getValue(); + + Assert.assertEquals(3, value.getIssueJIIB44DummyElementInfo().size()); + Assert.assertEquals(3, value.getIssueJIIB44DummyClassInfo().size()); + } + + public void testElementsPropertyAsElementPropertyType() throws Exception { + + IssueJIIB44ElementsPropertyAsElementPropertyType value = ((JAXBElement) context + .createUnmarshaller().unmarshal( + getClass().getResourceAsStream("issueJIIB44_2.xml"))) + .getValue(); + + Assert.assertEquals(3, value.getString().size()); + Assert.assertEquals(3, value.getInt().size()); + } +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java new file mode 100644 index 00000000..14b85427 --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB8Test.java @@ -0,0 +1,19 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import java.util.Arrays; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class JIIB8Test extends TestCase { + + public void testCollectionSetters() throws Exception { + + final IssueJIIB8Type one = new IssueJIIB8Type(); + + one.setValue(Arrays.asList("1", "2", "3")); + + Assert.assertEquals(3, one.getValue().size()); + + } +} diff --git a/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java new file mode 100644 index 00000000..978a6bdb --- /dev/null +++ b/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/RunIssuesPlugin.java @@ -0,0 +1,42 @@ +package org.jvnet.jaxb2_commons.tests.issues; + +import java.util.ArrayList; +import java.util.List; + +import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; +import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; + +public class RunIssuesPlugin extends RunXJC2Mojo { + + @Override + protected void configureMojo(AbstractXJC2Mojo mojo) { + super.configureMojo(mojo); + mojo.setExtension(true); + mojo.setForceRegenerate(true); + } + + @Override + public List getArgs() { + final List args = new ArrayList(super.getArgs()); +// args.add("-XelementWrapper"); + args.add("-XtoString"); + args.add("-Xequals"); + args.add("-XhashCode"); + args.add("-Xcopyable"); + args.add("-Xmergeable"); + args.add("-Xinheritance"); + args.add("-Xsetters"); + args.add("-Xsetters-mode=direct"); + args.add("-Xwildcard"); + args.add("-XautoInheritance"); + args.add("-XautoInheritance-xmlRootElementsExtend=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseClass"); + args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceOne"); + args.add("-XautoInheritance-xmlRootElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceTwo"); + args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceThree"); + args.add("-XautoInheritance-jaxbElementsImplement=org.jvnet.jaxb2_commons.tests.issues.IssueJIIB14BaseInterfaceFour"); + args.add("-Xannotate"); + args.add("-Xsimplify"); + return args; + } + +} diff --git a/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml new file mode 100644 index 00000000..dbab4d40 --- /dev/null +++ b/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml new file mode 100644 index 00000000..62bf2a3d --- /dev/null +++ b/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml new file mode 100644 index 00000000..f88c9419 --- /dev/null +++ b/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml @@ -0,0 +1,8 @@ + + a + b + 0 + c + 1 + 2 + \ No newline at end of file diff --git a/tests/issues/src/test/samples/issue16[0].xml b/tests/issues/src/test/samples/issue16[0].xml new file mode 100644 index 00000000..c72740a1 --- /dev/null +++ b/tests/issues/src/test/samples/issue16[0].xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tests/one/.classpath b/tests/one/.classpath new file mode 100644 index 00000000..a157a019 --- /dev/null +++ b/tests/one/.classpath @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/basics/tags/0.8.0/tests/one/.project b/tests/one/.project similarity index 100% rename from basics/tags/0.8.0/tests/one/.project rename to tests/one/.project diff --git a/tests/one/.settings/org.eclipse.core.resources.prefs b/tests/one/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..1fe04a94 --- /dev/null +++ b/tests/one/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding//target/generated-sources/xjc=UTF-8 +encoding/=UTF-8 diff --git a/tests/one/.settings/org.eclipse.jdt.core.prefs b/tests/one/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..60105c1b --- /dev/null +++ b/tests/one/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/trunk/tests/one/pom.xml b/tests/one/pom.xml similarity index 100% rename from basics/trunk/tests/one/pom.xml rename to tests/one/pom.xml diff --git a/tests/one/src/main/resources/binding.xjb b/tests/one/src/main/resources/binding.xjb new file mode 100644 index 00000000..de18ea4f --- /dev/null +++ b/tests/one/src/main/resources/binding.xjb @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/tests/one/src/main/resources/schema.xsd b/tests/one/src/main/resources/schema.xsd new file mode 100644 index 00000000..ab550dbd --- /dev/null +++ b/tests/one/src/main/resources/schema.xsd @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java new file mode 100644 index 00000000..4a519233 --- /dev/null +++ b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/CopyableTest.java @@ -0,0 +1,23 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import junit.framework.Assert; + +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class CopyableTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object original = createContext().createUnmarshaller().unmarshal( + sample); + final Object copy = JAXBCopyStrategy.INSTANCE.copy(null, original); + Assert.assertTrue("Source and copy must be equal.", + JAXBEqualsStrategy.INSTANCE.equals(null, null, original, copy)); + } + +} diff --git a/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java new file mode 100644 index 00000000..62d7aa4b --- /dev/null +++ b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/EqualsTest.java @@ -0,0 +1,20 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class EqualsTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object lhs = createContext().createUnmarshaller().unmarshal( + sample); + final Object rhs = createContext().createUnmarshaller().unmarshal( + sample); + assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals( + null, null, lhs, rhs)); + } +} diff --git a/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java new file mode 100644 index 00000000..7854efe1 --- /dev/null +++ b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/HashCodeTest.java @@ -0,0 +1,28 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy; +import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class HashCodeTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object lhs = createContext().createUnmarshaller().unmarshal( + sample); + final Object rhs = createContext().createUnmarshaller().unmarshal( + sample); + final Object chs = JAXBCopyStrategy.INSTANCE.copy(null, rhs); + final int leftHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, + 0, lhs); + final int rightHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, + 0, rhs); + final int copyHashCode = JAXBHashCodeStrategy.INSTANCE.hashCode(null, + 0, chs); + assertEquals("Values must be equal.", leftHashCode, rightHashCode); + assertEquals("Values must be equal.", leftHashCode, copyHashCode); + } +} diff --git a/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java new file mode 100644 index 00000000..49f55f19 --- /dev/null +++ b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java @@ -0,0 +1,33 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.util.ArrayList; +import java.util.List; + +import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo; +import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo; + +public class RunOnePlugin extends RunXJC2Mojo { + + @Override + protected void configureMojo(AbstractXJC2Mojo mojo) { + super.configureMojo(mojo); + mojo.setExtension(true); + mojo.setForceRegenerate(true); + mojo.setDebug(false); + } + + @Override + public List getArgs() { + final List args = new ArrayList(super.getArgs()); + args.add("-XtoString"); + args.add("-Xequals"); + args.add("-XhashCode"); + args.add("-Xcopyable"); + args.add("-Xmergeable"); + args.add("-Xinheritance"); + args.add("-Xsetters"); + args.add("-Xwildcard"); + return args; + } + +} diff --git a/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java new file mode 100644 index 00000000..4d6341a9 --- /dev/null +++ b/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/ToStringTest.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.tests.one; + +import java.io.File; + +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; +import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy; + +public class ToStringTest extends AbstractSamplesTest { + + @Override + protected void checkSample(File sample) throws Exception { + + final Object object = createContext().createUnmarshaller().unmarshal(sample); + System.out.println(JAXBToStringStrategy.INSTANCE.append(null, new StringBuilder(), object).toString()); + } + +} diff --git a/tests/one/src/test/resources/log4j.properties b/tests/one/src/test/resources/log4j.properties new file mode 100644 index 00000000..9c985635 --- /dev/null +++ b/tests/one/src/test/resources/log4j.properties @@ -0,0 +1,5 @@ +log4j.rootCategory=DEBUG, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.target=system.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/tests/one/src/test/samples/1.xml b/tests/one/src/test/samples/1.xml new file mode 100644 index 00000000..ea9f06b9 --- /dev/null +++ b/tests/one/src/test/samples/1.xml @@ -0,0 +1,11 @@ + + a + b + c + d + e + + 0 + 1 + + diff --git a/tests/one/src/test/samples/2.xml b/tests/one/src/test/samples/2.xml new file mode 100644 index 00000000..4d36079e --- /dev/null +++ b/tests/one/src/test/samples/2.xml @@ -0,0 +1,4 @@ + + a + 2001-01-01T00:00:00 + diff --git a/basics/trunk/tests/pom.xml b/tests/pom.xml similarity index 100% rename from basics/trunk/tests/pom.xml rename to tests/pom.xml diff --git a/tests/wildcard/.classpath b/tests/wildcard/.classpath new file mode 100644 index 00000000..278f68ed --- /dev/null +++ b/tests/wildcard/.classpath @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/basics/tags/0.8.0/tests/wildcard/.project b/tests/wildcard/.project similarity index 100% rename from basics/tags/0.8.0/tests/wildcard/.project rename to tests/wildcard/.project diff --git a/tests/wildcard/.settings/org.eclipse.core.resources.prefs b/tests/wildcard/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..5240b69c --- /dev/null +++ b/tests/wildcard/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding//target/generated-sources/xjc=UTF-8 +encoding/=UTF-8 diff --git a/tests/wildcard/.settings/org.eclipse.jdt.core.prefs b/tests/wildcard/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..60105c1b --- /dev/null +++ b/tests/wildcard/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/basics/tags/0.8.0/tests/wildcard/pom.xml b/tests/wildcard/pom.xml similarity index 100% rename from basics/tags/0.8.0/tests/wildcard/pom.xml rename to tests/wildcard/pom.xml diff --git a/tests/wildcard/src/main/resources/binding.xjb b/tests/wildcard/src/main/resources/binding.xjb new file mode 100644 index 00000000..610f6fb7 --- /dev/null +++ b/tests/wildcard/src/main/resources/binding.xjb @@ -0,0 +1,12 @@ + + + + + + diff --git a/tests/wildcard/src/main/resources/schema.xsd b/tests/wildcard/src/main/resources/schema.xsd new file mode 100644 index 00000000..7cc30c8f --- /dev/null +++ b/tests/wildcard/src/main/resources/schema.xsd @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/basics/trunk/tests/zj/pom.xml b/tests/zj/pom.xml similarity index 100% rename from basics/trunk/tests/zj/pom.xml rename to tests/zj/pom.xml diff --git a/tests/zj/src/main/resources/ObisData.xsd b/tests/zj/src/main/resources/ObisData.xsd new file mode 100644 index 00000000..b94d38a2 --- /dev/null +++ b/tests/zj/src/main/resources/ObisData.xsd @@ -0,0 +1,688 @@ + + + + + + + Ex: The width of an A0 roll or the size of a letter cut sheet + + + + + + + + + Ex: The ISO A media series + + + + + + + + + + + + Ex: The detailed description of all the resources that have changed since the last query. + + + + + + + + + + Ex: A metric data type + + + + + + + + + + + + + The list of the servers, queues, printer, emulations, inks, and all the resources installed on the customer site is defined in the system catalogue. + + + + + + + + + + + + + + + + The server catalogue lists all the servers installed on the customer site. In the current version, the server catalogue will list only one server. + + + + + + + + + + + + + The queue catalogue lists all the queues installed on the customer site. Job submissions are made through these queues. + + + + + + + + + + + + + The print catalogue lists all the printers installed on the customer site. + + + + + + + + + + + + + + + + + + + + + + + The ink catalogue lists all the ink cartridges, toners, etc... installed on the customer site. + + + + + + + + + + + + + The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The stamp catalogue lists all the stamps installed on the customer site. + + + + + + + + + + + + + The pen catalogue lists all the pens and set of pens installed on the customer site. + + + + + + + + + + + + + The color catalogue lists all the color profiles installed on the customer site. + + + + + + + + + + + + + + + + + + + A resource can be a media, a media type, a media size, a stamp, etc... + + + + + + + + + + The server offers submission queues and print capabilities to submit jobs to these queues. + + + + + + + + + + + + + A queue is used as an entry point in a server for submitting jobs. A queue generally addresses one printer. But it can also address several printers, in order to balance the print load. + + + + + + + + + + A printer is a physical device with the ability to print jobs. In OBIS, the printers are not addressed directly; jobs are submitted to a queue. + + + + + + + + + + + + + + An emulation is the complete or partial support of a page description language. + + + + + + + + + + + + Inks are used to print documents. + + + + + + + + + + + + + + + + + + + + + + + + + A media family is a list of media types that are considered equivalent. For instance, if a standard paper is considered equivalent to a plain paper, then they both belong to the same media family. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A media is either a roll or a sheet. If the identifier of the media size references a roll size, then the media is a roll. If the identifier of the media size references a sheet size, then the media is a sheet. + + + + + + + + + + + + + + + + + + + + A pen set is a collection of pens used in some data formats to trace lines, polygons, circles, filled areas, etc... + + + + + + + + + + A color profile is a resource that specifies the parameters of a color space. + + + + + + + + + + + The print capabilities of the server contain all the information needed by a publisher application to compose and submit jobs to any queue of the server. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The print capability of a queue can be returned independently of the server capabilities. In that case, all the capabilities of the queue are returned, and not only those that are different than the server capabilities. + + + + + + + + + + + + A print capability represents a print resource or a print instruction that can be specified in a job ticket. Each capability has a range of available values. + + + + + + + + + + + + + + + + + + + + A print setting is a print resource or a print instruction that can be set in a job ticket in order to specify how to print a job. + + + + + + + + + A hardware constraint represents a limitation on a physical printer device. They are strongly device dependant. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The job ticket expresses how a set of documents (a job) shall be printed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The document ticket expresses how a document shall be printed. + + + + + + + + + + + + + + + The page ticket expresses how one or more pages of a document shall be printed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The media catalogue lists all the media installed on the customer site. A media can be installed, and not physically loaded on the printer. When a job submission is made with a non-loaded media, a media request will be issued at print time. + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java b/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java new file mode 100644 index 00000000..443f1ffb --- /dev/null +++ b/tests/zj/src/test/java/org/jvnet/jaxb2_commons/tests/zj/EqualsTest.java @@ -0,0 +1,21 @@ +package org.jvnet.jaxb2_commons.tests.zj; + +import java.io.File; + +import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy; +import org.jvnet.jaxb2_commons.test.AbstractSamplesTest; + +public class EqualsTest extends AbstractSamplesTest { + + @Override + public String getContextPath() { + return "com.oce.obis.sei.api.data"; + } + + @Override + protected void checkSample(File sample) throws Exception { + final Object lhs = createContext().createUnmarshaller().unmarshal(sample); + final Object rhs = createContext().createUnmarshaller().unmarshal(sample); + assertTrue("Values must be equal.", JAXBEqualsStrategy.INSTANCE.equals(null, null, lhs, rhs)); + } +} diff --git a/tests/zj/src/test/resources/log4j.properties b/tests/zj/src/test/resources/log4j.properties new file mode 100644 index 00000000..9c985635 --- /dev/null +++ b/tests/zj/src/test/resources/log4j.properties @@ -0,0 +1,5 @@ +log4j.rootCategory=DEBUG, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.target=system.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n \ No newline at end of file diff --git a/tests/zj/src/test/samples/MediaCatalogue.xml b/tests/zj/src/test/samples/MediaCatalogue.xml new file mode 100644 index 00000000..b60fe1ff --- /dev/null +++ b/tests/zj/src/test/samples/MediaCatalogue.xml @@ -0,0 +1,57 @@ + + + + + 1 + first roll + This is the first roll + 1111 + 11 + + + 123 + second roll + This is the second roll + 2222 + 22 + + + + + 1 + first roll size + This is the first roll size + 111 + + 5 + 6 + 7 + 8 + + + 1 + 2 + 3 + 4 + + + + 2 + second roll size + This is the second roll size + 222 + + 5 + 6 + 7 + 8 + + + 1 + 2 + 3 + 4 + + + + diff --git a/tools/.classpath b/tools/.classpath new file mode 100644 index 00000000..bc5aeac5 --- /dev/null +++ b/tools/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/basics/tags/0.6.4/tools/.project b/tools/.project similarity index 100% rename from basics/tags/0.6.4/tools/.project rename to tools/.project diff --git a/basics/trunk/tools/pom.xml b/tools/pom.xml similarity index 100% rename from basics/trunk/tools/pom.xml rename to tools/pom.xml diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java new file mode 100644 index 00000000..1fa66ab5 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java @@ -0,0 +1,55 @@ +package org.jvnet.jaxb2_commons.plugin; + +import java.io.IOException; + +import org.apache.commons.beanutils.BeanUtils; + +import com.sun.tools.xjc.BadCommandLineException; +import com.sun.tools.xjc.Options; + +/** + * Abstract base class for parameterizable JAXB plugins. + *

+ * This plugin looks for the arguments of the form + * -myPlugin-name=value + * (myPlugin is the plugin option name) and + * then invokes setName(value) on itself.

+ *

For instance, the argument -Xfoo-bar=test triggers + * setBar("test") invocation.

+ *

Values are injected using Commons BeanUtils as bean properties, so + * types will be converted correspondingly + * + * @author valikov + */ +public abstract class AbstractParameterizablePlugin extends AbstractPlugin { + + /** + * Parses the arguments and injects values into the beans via properties. + */ + public int parseArgument(Options opt, String[] args, int start) + throws BadCommandLineException, IOException { + + int consumed = 0; + final String optionPrefix = "-" + getOptionName() + "-"; + final int optionPrefixLength = optionPrefix.length(); + + final String arg = args[start]; + final int equalsPosition = arg.indexOf('='); + + if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { + final String propertyName = arg.substring(optionPrefixLength, + equalsPosition); + + 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 + "]."); + } + } + return consumed; + } +} \ No newline at end of file diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java new file mode 100644 index 00000000..fad06afb --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractPlugin.java @@ -0,0 +1,121 @@ +package org.jvnet.jaxb2_commons.plugin; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import com.sun.tools.xjc.BadCommandLineException; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.Plugin; +import com.sun.tools.xjc.outline.Outline; + +public abstract class AbstractPlugin extends Plugin { + + /** + * Plugin logger. + */ + protected Log logger = LogFactory.getLog(getClass()); + + @Override + public void onActivated(Options options) throws BadCommandLineException { + super.onActivated(options); + try { + init(options); + } catch (Exception ex) { + throw new BadCommandLineException( + "Could not initialize the plugin [" + getOptionName() + + "].", ex); + } + } + + @Override + public boolean run(Outline outline, Options options, + ErrorHandler errorHandler) throws SAXException { + /* + * try { init(options); } catch (Exception ex) { SAXParseException saxex + * = new SAXParseException( "Could not initialize Spring context.", + * null, ex); errorHandler.fatalError(saxex); throw saxex; } + */ + try { + beforeRun(outline, options); + return run(outline, options); + } catch (Exception ex) { + final SAXParseException saxex = new SAXParseException( + "Error during plugin execution.", null, ex); + errorHandler.error(saxex); + throw saxex; + } finally { + try { + afterRun(outline, options); + } catch (Exception ex) { + final SAXParseException saxex = new SAXParseException( + "Error during plugin execution.", null, ex); + errorHandler.error(saxex); + throw saxex; + + } + } + } + + protected void beforeRun(Outline outline, Options options) throws Exception { + + } + + protected boolean run(Outline outline, Options options) throws Exception { + return true; + } + + protected void afterRun(Outline outline, Options options) throws Exception { + + } + + protected void init(Options options) throws Exception { + } + + public Collection getCustomizationElementNames() { + return Collections. emptyList(); + } + + private List customizationURIs; + + private Set customizationElementNames; + + @Override + public List getCustomizationURIs() { + if (this.customizationURIs == null) { + final Collection customizationElementNames = getCustomizationElementNames(); + this.customizationURIs = new ArrayList( + customizationElementNames.size()); + for (QName customizationElementName : customizationElementNames) { + final String namespaceURI = customizationElementName + .getNamespaceURI(); + if (!(namespaceURI== null || namespaceURI.length() == 0)) { + this.customizationURIs.add(namespaceURI); + } + } + } + return this.customizationURIs; + } + + @Override + public boolean isCustomizationTagName(String namespaceURI, String localName) { + if (this.customizationElementNames == null) { + this.customizationElementNames = new HashSet( + getCustomizationElementNames()); + } + return this.customizationElementNames.contains(new QName(namespaceURI, + localName)); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java new file mode 100644 index 00000000..90b9016d --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/spring/AbstractSpringConfigurablePlugin.java @@ -0,0 +1,83 @@ +package org.jvnet.jaxb2_commons.plugin.spring; + +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.context.support.AbstractXmlApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; + +import com.sun.tools.xjc.BadCommandLineException; +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.Outline; + +public abstract class AbstractSpringConfigurablePlugin extends + AbstractParameterizablePlugin { + + protected Log logger = LogFactory.getLog(getClass()); + + private AbstractXmlApplicationContext applicationContext; + + public AbstractXmlApplicationContext getApplicationContext() { + return applicationContext; + } + + protected String[] getDefaultConfigLocations() { + return null; + } + + private String[] configLocations = getDefaultConfigLocations(); + + public String[] getConfigLocations() { + return configLocations; + } + + public void setConfigLocations(String[] configLocations) { + this.configLocations = configLocations; + } + + protected int getAutowireMode() { + return AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE; + } + + protected boolean isDependencyCheck() { + return false; + } + + public void init(Options options) throws Exception { + + } + + @Override + protected void beforeRun(Outline outline, Options options) throws Exception { + super.beforeRun(outline, options); + final String[] configLocations = getConfigLocations(); + if (!ArrayUtils.isEmpty(configLocations)) { + final String configLocationsString = ArrayUtils + .toString(configLocations); + logger.debug("Loading application context from [" + + configLocationsString + "]."); + try { + applicationContext = new FileSystemXmlApplicationContext( + configLocations, false); + applicationContext.setClassLoader(Thread.currentThread() + .getContextClassLoader()); + applicationContext.refresh(); + if (getAutowireMode() != AutowireCapableBeanFactory.AUTOWIRE_NO) { + applicationContext.getBeanFactory().autowireBeanProperties( + this, getAutowireMode(), isDependencyCheck()); + } + } catch (Exception ex) { + ex.printStackTrace(); + ex.getCause().printStackTrace(); + logger.error("Error loading applicaion context from [" + + configLocationsString + "].", ex); + throw new BadCommandLineException( + "Error loading applicaion context from [" + + configLocationsString + "].", ex); + } + } + } + +} \ No newline at end of file diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java new file mode 100644 index 00000000..31936d5b --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/ClassOutlineProcessor.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.strategy; + +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; + +public interface ClassOutlineProcessor { + public T process(C context, ClassOutline classOutline, Options options) throws Exception; + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java new file mode 100644 index 00000000..53a4b05b --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/FieldOutlineProcessor.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.strategy; + +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.FieldOutline; + +public interface FieldOutlineProcessor { + public T process(C context, FieldOutline fieldOutline, Options options) throws Exception; + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java new file mode 100644 index 00000000..84d045b4 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/OutlineProcessor.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.strategy; + +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.Outline; + +public interface OutlineProcessor { + + public T process(C context, Outline outline, Options options) throws Exception; + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java new file mode 100644 index 00000000..0d571557 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/PackageOutlineProcessor.java @@ -0,0 +1,10 @@ +package org.jvnet.jaxb2_commons.strategy; + +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.PackageOutline; + +public interface PackageOutlineProcessor { + public T process(C context, PackageOutline packageOutline, Options options) + throws Exception; + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java new file mode 100644 index 00000000..1a96abe4 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/strategy/impl/DefaultOutlineProcessor.java @@ -0,0 +1,41 @@ +package org.jvnet.jaxb2_commons.strategy.impl; + +import java.util.HashMap; +import java.util.Map; + +import org.jvnet.jaxb2_commons.strategy.ClassOutlineProcessor; +import org.jvnet.jaxb2_commons.strategy.OutlineProcessor; + +import com.sun.tools.xjc.Options; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.Outline; + +public class DefaultOutlineProcessor implements + OutlineProcessor, C> { + + private final ClassOutlineProcessor classOutlineProcessor; + + public DefaultOutlineProcessor( + final ClassOutlineProcessor classOutlineProcessor) { + this.classOutlineProcessor = classOutlineProcessor; + } + + public ClassOutlineProcessor getClassOutlineProcessor() { + return classOutlineProcessor; + } + + public Map process(C context, Outline outline, + Options options) throws Exception { + + final Map classMappingsMap = new HashMap(); + for (final ClassOutline classOutline : outline.getClasses()) { + final T result = getClassOutlineProcessor().process(context, + classOutline, options); + if (result != null) { + classMappingsMap.put(classOutline, result); + } + } + return classMappingsMap; + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java new file mode 100644 index 00000000..c473b750 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/ClassUtils.java @@ -0,0 +1,95 @@ +package org.jvnet.jaxb2_commons.util; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.FieldOutline; + +public class ClassUtils { + + // public static String getClassName(final ClassOutline classOutline) { + // return CodeModelUtils.getClassName(classOutline. .getTypeAsDefined()); + // } + // + + public static boolean contains(JDefinedClass theClass, String innerClassName) { + + for (final Iterator classes = theClass.classes(); classes + .hasNext();) { + final JDefinedClass innerClass = classes.next(); + if (innerClassName.equals(innerClass.name())) + return true; + } + return false; + } + + public static void _implements(JDefinedClass theClass, JClass theInterface) { + if (!isImplementing(theClass, theInterface)) + theClass._implements(theInterface); + } + + public static boolean isImplementing(JDefinedClass theClass, + JClass theInterface) { + for (Iterator iterator = theClass._implements(); iterator + .hasNext();) { + final JClass implementedInterface = iterator.next(); + if (theInterface.equals(implementedInterface)) { + return true; + } + } + return false; + } + + public static List getAncestors(ClassOutline classOutline) { + final List classOutlines = new LinkedList(); + addAncestors(classOutline, classOutlines); + return classOutlines; + } + + public static List getAncestorsAndSelf( + ClassOutline classOutline) { + final List classOutlines = new LinkedList(); + classOutlines.add(classOutline); + addAncestors(classOutline, classOutlines); + return classOutlines; + } + + private static void addAncestors(ClassOutline classOutline, + List classOutlines) { + if (classOutline.getSuperClass() != null) { + final ClassOutline superClassOutline = classOutline.getSuperClass(); + addAncestors(superClassOutline, classOutlines); + } + } + + public static FieldOutline[] getFields(ClassOutline classOutline) { + final List fields = new ArrayList(); + fields.addAll(Arrays.asList(classOutline.getDeclaredFields())); + if (classOutline.getSuperClass() != null) { + fields.addAll(Arrays + .asList(getFields(classOutline.getSuperClass()))); + } + return fields.toArray(new FieldOutline[fields.size()]); + } + + public static String getPackagedClassName(final CClassInfo classInfo) { + + if (classInfo.parent() instanceof CClassInfo) { + return getPackagedClassName((CClassInfo) classInfo.parent()) + '$' + + classInfo.shortName; + } else { + final String r = classInfo.parent().fullName(); + if (r.length() == 0) + return classInfo.shortName; + else + return r + '.' + classInfo.shortName; + } + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java new file mode 100644 index 00000000..cf1a8dcc --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/CodeModelUtils.java @@ -0,0 +1,271 @@ +package org.jvnet.jaxb2_commons.util; + +import java.util.Iterator; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JClassAlreadyExistsException; +import com.sun.codemodel.JClassContainer; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JPackage; +import com.sun.codemodel.JPrimitiveType; +import com.sun.codemodel.JResourceFile; +import com.sun.codemodel.JStatement; +import com.sun.codemodel.JType; +import com.sun.codemodel.fmt.JPropertyFile; +import com.sun.tools.xjc.outline.ClassOutline; + +/** + * Property file utilities. + * + * @author valikov + */ +public class CodeModelUtils { + private CodeModelUtils() { + } + + /** + * Returns a property file (created if necessary). + * + * @param thePackage + * package to create property file + * @param name + * property file name. + * @return Property file. + */ + + public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage, + String name) { + JPropertyFile propertyFile = null; + for (Iterator iterator = thePackage.propertyFiles(); iterator + .hasNext() && (null == propertyFile);) { + final JResourceFile resourceFile = (JResourceFile) iterator.next(); + if (resourceFile instanceof JPropertyFile + && name.equals(resourceFile.name())) { + propertyFile = (JPropertyFile) resourceFile; + } + } + + if (null == propertyFile) { + propertyFile = new JPropertyFile(name); + thePackage.addResourceFile(propertyFile); + } + return propertyFile; + } + + // public static boolean doesImplement(JDefinedClass theClass, JClass + // theInterface) + // { + // theClass._i + // } + + public static String getClassName(final JClass theClass) { + return (theClass.outer() == null ? theClass.fullName() + : getClassName(theClass.outer()) + "$" + theClass.name()); + } + + public static String getLocalClassName(final JClass theClass) { + return (theClass.outer() == null ? theClass.name() + : getLocalClassName(theClass.outer()) + "$" + theClass.name()); + } + + public static String getDottedLocalClassName(final JClass theClass) { + return (theClass.outer() == null ? theClass.name() + : getDottedLocalClassName(theClass.outer()) + "." + + theClass.name()); + } + + public static String getPackagedClassName(final JClass theClass) { + return (theClass.outer() == null ? theClass.fullName() + : getPackagedClassName(theClass.outer()) + "$" + + theClass.name()); + } + + public static JClass box(JType t) { + if (t instanceof JClass) + return (JClass) t; + else + return ((JPrimitiveType) t).boxify(); + } + + public static JDefinedClass getOrCreateClass(JClassContainer container, + int flags, String name) { + try { + return container._class(flags, name); + } catch (JClassAlreadyExistsException jcaeex) { + return jcaeex.getExistingClass(); + } + } + + public static JDefinedClass getOrCreateClass(JCodeModel codeModel, + int flags, String fullClassName) { + final String packageName; + final String className; + final int lastDotIndex = fullClassName.lastIndexOf('.'); + if (lastDotIndex >= 0) { + packageName = fullClassName.substring(0, lastDotIndex); + className = fullClassName.substring(lastDotIndex + 1); + } else { + packageName = ""; + className = fullClassName; + } + final JPackage thePackage = codeModel._package(packageName); + return getOrCreateClass(thePackage, flags, className); + } + + public static JStatement split(JDefinedClass theClass, + JStatement[] statements, String prefix, int start, int length, + int threshold) { + final JMethod method = theClass.method(JMod.PRIVATE + JMod.STATIC, + theClass.owner().VOID, prefix); + if (length < threshold) { + for (int index = start; (index - start) < length; index++) { + final JStatement statement = statements[index]; + method.body().add(statement); + } + } else { + method.body().add( + split(theClass, statements, prefix + "_0", start, + length / 2, threshold)); + method.body().add( + split(theClass, statements, prefix + "_1", start + length + / 2, length - (length / 2), threshold)); + } + return JExpr.invoke(method); + } + + public static JMethod getMethod(JDefinedClass theClass, String name, + JType[] arguments) { + final JMethod method = theClass.getMethod(name, arguments); + if (method != null) { + return method; + } else { + final JClass draftSuperClass = theClass._extends(); + if (draftSuperClass == null + || !(draftSuperClass instanceof JDefinedClass)) { + return null; + } else { + final JDefinedClass superClass = (JDefinedClass) draftSuperClass; + return getMethod(superClass, name, arguments); + } + } + } + + public static JMethod getMethod(final JDefinedClass theClass, + final String name) { + for (JMethod method : theClass.methods()) { + if (method.name().equals(name)) + return method; + } + return null; + } + + public static JMethod getMethod(final ClassOutline classOutline, + final String name) { + final JDefinedClass ref = classOutline.ref; + final JMethod method = getMethod(ref, name); + if (method != null) { + return method; + } else { + final ClassOutline superClassOutline = classOutline.getSuperClass(); + if (superClassOutline == null) { + return null; + } else { + return getMethod(superClassOutline, name); + } + } + } + + public static JCodeModel getCodeModel(ClassOutline classOutline) { + return classOutline.ref.owner(); + } + + public static JType ref(JCodeModel codeModel, String className) { + try { + // try the context class loader first + return codeModel.ref(Thread.currentThread().getContextClassLoader() + .loadClass(className)); + } catch (ClassNotFoundException e) { + // fall through + } + // then the default mechanism. + try { + return codeModel.ref(Class.forName(className)); + } catch (ClassNotFoundException e1) { + // fall through + } + + { + JDefinedClass _class = _getClass(codeModel, className); + if (_class != null) { + return _class; + } + } + return codeModel.ref(className.replace('$', '.')); + } + + public static JDefinedClass _getClass(JCodeModel codeModel, + String fullyQualifiedName) { + final int idx = fullyQualifiedName.lastIndexOf('.'); + if (idx < 0) { + return codeModel.rootPackage()._getClass(fullyQualifiedName); + } else { + final String packageName = fullyQualifiedName.substring(0, idx); + for (Iterator iterator = codeModel.packages(); iterator + .hasNext();) { + final JPackage _package = iterator.next(); + if (packageName.equals(_package.name())) { + return _getClass(_package, + fullyQualifiedName.substring(idx + 1)); + } + } + return null; + } + + } + + public static JDefinedClass _getClass(JPackage _package, String name) { + final int idx = name.lastIndexOf('$'); + if (idx < 0) { + return _package._getClass(name); + } else { + final String parentClassName = name.substring(0, idx); + final JDefinedClass parentClass = _package + ._getClass(parentClassName); + if (parentClass == null) { + return null; + } else { + return _getClass(parentClass, name.substring(idx + 1)); + } + + } + + } + + public static JDefinedClass _getClass(JDefinedClass _class, String name) { + final int idx = name.lastIndexOf('$'); + if (idx < 0) { + for (Iterator nestedClasses = _class.classes(); nestedClasses + .hasNext();) { + final JDefinedClass nestedClass = nestedClasses.next(); + if (nestedClass.name().equals(name)) { + return nestedClass; + } + } + return null; + + } else { + final JDefinedClass nestedClass = _getClass(_class, + name.substring(0, idx)); + if (nestedClass == null) { + return null; + } else { + return _getClass(nestedClass, name.substring(idx + 1)); + } + } + } + +} \ No newline at end of file diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java new file mode 100644 index 00000000..ca739e53 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/CustomizationUtils.java @@ -0,0 +1,654 @@ +package org.jvnet.jaxb2_commons.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.JAXBIntrospector; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import com.sun.tools.xjc.model.CAttributePropertyInfo; +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.CCustomizable; +import com.sun.tools.xjc.model.CCustomizations; +import com.sun.tools.xjc.model.CElement; +import com.sun.tools.xjc.model.CElementInfo; +import com.sun.tools.xjc.model.CElementPropertyInfo; +import com.sun.tools.xjc.model.CEnumConstant; +import com.sun.tools.xjc.model.CEnumLeafInfo; +import com.sun.tools.xjc.model.CPluginCustomization; +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.model.CPropertyVisitor; +import com.sun.tools.xjc.model.CReferencePropertyInfo; +import com.sun.tools.xjc.model.CValuePropertyInfo; +import com.sun.tools.xjc.model.Model; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.ElementOutline; +import com.sun.tools.xjc.outline.EnumConstantOutline; +import com.sun.tools.xjc.outline.EnumOutline; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; + +public class CustomizationUtils { + + private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY; + + static { + DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); + // try { + // DOCUMENT_BUILDER = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); + // } catch (ParserConfigurationException pce) { + // throw new ExceptionInInitializerError(pce); + // } + } + + public static DocumentBuilder getDocumentBuilder() { + try { + return DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); + } catch (ParserConfigurationException pce) { + throw new AssertionError(pce); + } + } + + public static CPluginCustomization createCustomization(QName name) { + final Document document = getDocumentBuilder().newDocument(); + final Element element = document.createElementNS( + name.getNamespaceURI(), name.getLocalPart()); + return createCustomization(element); + } + + public static CPluginCustomization createCustomization(final Element element) { + final CPluginCustomization customization = new CPluginCustomization( + element, null); + return customization; + } + + public static boolean containsCustomization(Outline outline, QName name) { + final CPluginCustomization customization = findCustomization(outline, + name); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization != null; + } + + public static boolean containsCustomization(Model model, QName name) { + final CPluginCustomization customization = findCustomization(model, + name); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization != null; + } + + public static boolean containsCustomization(ClassOutline classOutline, + QName name) { + final CPluginCustomization customization = findCustomization( + classOutline, name); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization != null; + } + + public static boolean containsCustomization(EnumOutline enumOutline, + QName name) { + final CPluginCustomization customization = findCustomization( + enumOutline, name); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization != null; + } + + public static boolean containsCustomization(CClassInfo classInfo, QName name) { + final CPluginCustomization customization = findCustomization(classInfo, + name); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization != null; + } + + public static CPluginCustomization findCustomization( + ClassOutline classOutline, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(classOutline); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static CPluginCustomization findCustomization( + EnumOutline classOutline, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(classOutline); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static CPluginCustomization findCustomization( + ElementOutline elementOutline, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(elementOutline); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static List findCustomizations( + ClassOutline classOutline, QName name) { + return findCustomizations(classOutline.target, name); + } + + public static List findCustomizations( + EnumOutline enumOutline, QName name) { + return findCustomizations(enumOutline.target, name); + } + + public static List findCustomizations( + ElementOutline elementOutline, QName name) { + return findCustomizations(elementOutline.target, name); + } + + public static List findCustomizations( + CClassInfo classInfo, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(classInfo); + + final List pluginCustomizations = new LinkedList(); + + for (CPluginCustomization pluginCustomization : customizations) { + if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( + name.getNamespaceURI()) + && fixNull(pluginCustomization.element.getLocalName()) + .equals(name.getLocalPart())) { + pluginCustomization.markAsAcknowledged(); + pluginCustomizations.add(pluginCustomization); + } + } + + return pluginCustomizations; + } + + public static List findCustomizations( + CEnumLeafInfo enumInfo, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(enumInfo); + + final List pluginCustomizations = new LinkedList(); + + for (CPluginCustomization pluginCustomization : customizations) { + if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( + name.getNamespaceURI()) + && fixNull(pluginCustomization.element.getLocalName()) + .equals(name.getLocalPart())) { + pluginCustomization.markAsAcknowledged(); + pluginCustomizations.add(pluginCustomization); + } + } + + return pluginCustomizations; + } + + public static List findCustomizations( + CElementInfo elementInfo, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(elementInfo); + + final List pluginCustomizations = new LinkedList(); + + for (CPluginCustomization pluginCustomization : customizations) { + if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( + name.getNamespaceURI()) + && fixNull(pluginCustomization.element.getLocalName()) + .equals(name.getLocalPart())) { + pluginCustomization.markAsAcknowledged(); + pluginCustomizations.add(pluginCustomization); + } + } + + return pluginCustomizations; + } + + public static List findCustomizations( + Outline outline, QName name) { + return findCustomizations(outline.getModel(), name); + } + + public static List findCustomizations(Model model, + QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(model); + + final List pluginCustomizations = new LinkedList(); + + for (CPluginCustomization pluginCustomization : customizations) { + if (fixNull(pluginCustomization.element.getNamespaceURI()).equals( + name.getNamespaceURI()) + && fixNull(pluginCustomization.element.getLocalName()) + .equals(name.getLocalPart())) { + pluginCustomization.markAsAcknowledged(); + pluginCustomizations.add(pluginCustomization); + } + } + + return pluginCustomizations; + } + + public static CPluginCustomization findCustomization(CClassInfo classInfo, + QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(classInfo); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static CPluginCustomization findCustomization( + CEnumLeafInfo enumLeafInfo, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(enumLeafInfo); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static CPluginCustomization findCustomization( + CElementInfo elementInfo, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(elementInfo); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static boolean containsCustomization(FieldOutline fieldOutline, + QName name) { + final CPluginCustomization customization = findCustomization( + fieldOutline, name); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization != null; + } + + public static boolean containsCustomization(CEnumLeafInfo enumLeafInfo, + QName name) { + final CPluginCustomization customization = findCustomization( + enumLeafInfo, name); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization != null; + } + + public static boolean containsCustomization(CPropertyInfo propertyInfo, + QName name) { + final CPluginCustomization customization = findCustomization( + propertyInfo, name); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization != null; + } + + public static CPluginCustomization findCustomization( + FieldOutline fieldOutline, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(fieldOutline); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static CPluginCustomization findCustomization( + CPropertyInfo propertyInfo, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(propertyInfo); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static CPluginCustomization findCustomization(Outline outline, + QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(outline); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + public static CPluginCustomization findCustomization(Model model, QName name) { + final CCustomizations customizations = CustomizationUtils + .getCustomizations(model); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) { + customization.markAsAcknowledged(); + } + return customization; + } + + // public static BIXPluginCustomization getCustomization(JavaItem item, + // QName name) { + // final BIXPluginCustomization[] customizations = getCustomizations(item, + // name); + // if (customizations == null || customizations.length < 1) { + // return null; + // } + // else { + // return customizations[0]; + // } + // } + + public static FieldOutline findFieldWithCustomization( + ClassOutline classOutline, final QName name) { + + for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { + final CCustomizations customizations = getCustomizations(fieldOutline); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) + return fieldOutline; + } + return null; + + } + + public static CPropertyInfo findPropertyWithCustomization( + CClassInfo classInfo, final QName name) { + + for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { + final CCustomizations customizations = getCustomizations(propertyInfo); + final CPluginCustomization customization = customizations.find( + name.getNamespaceURI(), name.getLocalPart()); + if (customization != null) + return propertyInfo; + } + return null; + } + + public static FieldOutline findInheritedFieldWithCustomization( + ClassOutline classOutline, final QName name) { + for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { + if (containsCustomization(fieldOutline, name)) { + return fieldOutline; + } + } + final ClassOutline superClassOutline = classOutline.getSuperClass(); + if (superClassOutline != null) { + return findInheritedFieldWithCustomization(superClassOutline, name); + } else { + return null; + } + } + + public static CPropertyInfo findInheritedPropertyWithCustomization( + CClassInfo classInfo, final QName name) { + for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { + if (containsCustomization(propertyInfo, name)) { + return propertyInfo; + } + } + final CClassInfo superClassInfo = classInfo.getBaseClass(); + if (superClassInfo != null) { + return findInheritedPropertyWithCustomization(superClassInfo, name); + } else { + return null; + } + } + + public static CCustomizations getCustomizations( + ElementOutline elementOutline) { + return getCustomizations(elementOutline.target); + } + + public static CCustomizations getCustomizations( + final CElementInfo elementInfo) { + return elementInfo.getCustomizations(); + } + + public static CCustomizations getCustomizations(EnumOutline enumOutline) { + return getCustomizations(enumOutline.target); + } + + public static CCustomizations getCustomizations( + EnumConstantOutline enumConstantOutline) { + return getCustomizations(enumConstantOutline.target); + } + + public static CCustomizations getCustomizations(FieldOutline fieldOutline) { + return getCustomizations(fieldOutline.getPropertyInfo()); + } + + public static CCustomizations getCustomizations(final Outline outline) { + return getCustomizations(outline.getModel()); + } + + public static CCustomizations getCustomizations(final Model model) { + final CCustomizations main = new CCustomizations( + model.getCustomizations()); + return main; + } + + public static CCustomizations getCustomizations( + final CPropertyInfo propertyInfo) { + + final CCustomizations main = new CCustomizations( + propertyInfo.getCustomizations()); + + final Collection elementCustomizations = propertyInfo + .accept(new CPropertyVisitor>() { + public Collection onAttribute( + CAttributePropertyInfo info) { + return Collections.emptyList(); + } + + public Collection onElement( + CElementPropertyInfo arg0) { + return Collections.emptyList(); + } + + public Collection onReference( + CReferencePropertyInfo info) { + + final List elementCustomizations = new ArrayList( + info.getElements().size()); + + for (CElement element : info.getElements()) { + if (!(element instanceof CElementInfo && ((CElementInfo) element) + .hasClass())) { + elementCustomizations.add(element + .getCustomizations()); + } + } + + return elementCustomizations; + } + + public Collection onValue( + CValuePropertyInfo arg0) { + return Collections.emptyList(); + }; + + }); + + CCustomizations customizations = main; + + for (CCustomizations e : elementCustomizations) { + main.addAll(e); + } + + return customizations; + } + + public static CCustomizations getCustomizations(ClassOutline classOutline) { + return getCustomizations(classOutline.target); + } + + public static CCustomizations getCustomizations(final CClassInfo classInfo) { + return classInfo.getCustomizations(); + } + + public static CCustomizations getCustomizations( + final CEnumLeafInfo enumLeafInfo) { + return enumLeafInfo.getCustomizations(); + } + + public static CCustomizations getCustomizations( + final CEnumConstant enumConstant) { + final Object _enumConstant = enumConstant; + if (_enumConstant instanceof CCustomizable) { + return ((CCustomizable) _enumConstant).getCustomizations(); + } else { + return CCustomizations.EMPTY; + } + } + + private static String fixNull(String s) { + if (s == null) { + return ""; + } else { + return s; + } + } + + public static Object unmarshall(final JAXBContext context, + final CPluginCustomization customization) throws AssertionError { + if (customization == null) { + return null; + } else + + { + final Unmarshaller unmarshaller; + try { + unmarshaller = context.createUnmarshaller(); + } catch (JAXBException ex) { + final AssertionError error = new AssertionError( + "Unmarshaller could not be created."); + error.initCause(ex); + throw error; + } + + try { + final Object result = unmarshaller.unmarshal(new DOMSource( + customization.element)); + final JAXBIntrospector introspector = context + .createJAXBIntrospector(); + if (introspector.isElement(result)) { + return JAXBIntrospector.getValue(result); + } else { + return result; + } + } catch (JAXBException ex) { + throw new IllegalArgumentException( + "Could not unmarshal the customization.", ex); + } + + } + } + + public static CPluginCustomization marshal(final JAXBContext context, + final QName name, final Object object) { + + try { + + final JAXBIntrospector introspector = context + .createJAXBIntrospector(); + + final Object value; + { + if (introspector.isElement(object)) { + value = object; + } else { + @SuppressWarnings("unchecked") + final JAXBElement jaxbElement = new JAXBElement(name, + object.getClass(), object); + value = jaxbElement; + } + + } + + final Marshaller marshaller = context.createMarshaller(); + + final DOMResult result = new DOMResult(); + + marshaller.marshal(value, result); + + final Node node = result.getNode(); + + final Element element; + if (node instanceof Element) + + { + element = (Element) node; + } else if (node instanceof Document) { + element = ((Document) node).getDocumentElement(); + } else { + element = null; + throw new IllegalArgumentException( + "Could not marhsall object into an element."); + } + return new CPluginCustomization(element, null); + } catch (JAXBException jaxbex) { + throw new IllegalArgumentException( + "Could not marhsall object into an element.", jaxbex); + + } + } + + public static CPluginCustomization addCustomization( + CCustomizable customizable, JAXBContext context, QName name, + Object object) { + final CPluginCustomization customization = marshal(context, name, + object); + customizable.getCustomizations().add(customization); + return customization; + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java new file mode 100644 index 00000000..369f881a --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorFactory.java @@ -0,0 +1,12 @@ +package org.jvnet.jaxb2_commons.util; + +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; + +import com.sun.codemodel.JExpression; +import com.sun.tools.xjc.outline.FieldOutline; + +public interface FieldAccessorFactory { + + public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, + JExpression targetObject); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java new file mode 100644 index 00000000..d178ce92 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldAccessorUtils.java @@ -0,0 +1,81 @@ +package org.jvnet.jaxb2_commons.util; + +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JFieldVar; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JType; +import com.sun.tools.xjc.outline.FieldOutline; + +public class FieldAccessorUtils { + + private static final JType[] NONE = new JType[0]; + + public static JMethod getter(FieldOutline fieldOutline) { + final JDefinedClass theClass = fieldOutline.parent().implClass; + final String publicName = fieldOutline.getPropertyInfo().getName(true); + final JMethod getgetter = theClass.getMethod("get" + publicName, NONE); + if (getgetter != null) { + return getgetter; + } else { + final JMethod isgetter = theClass + .getMethod("is" + publicName, NONE); + if (isgetter != null) { + return isgetter; + } else { + return null; + } + } + } + + /** + * Returns the isSetProperty() method for the given field + * outline or null if no such method exists. + * + * @param fieldOutline + * field outline. + * @return The isSetProperty() method for the given field + * outline or null if no such method exists. + */ + public static JMethod issetter(FieldOutline fieldOutline) { + final JDefinedClass theClass = fieldOutline.parent().implClass; + final String publicName = fieldOutline.getPropertyInfo().getName(true); + final String name = "isSet" + publicName; + return theClass.getMethod(name, NONE); + } + + /** + * Returns the field for the given field outline or null if no + * such field exists. + * + * @param fieldOutline + * field outline. + * @return The field for the given field outline or null if no + * such field exists. + */ + public static JFieldVar field(FieldOutline fieldOutline) { + final JDefinedClass theClass = fieldOutline.parent().implClass; + return theClass.fields().get( + fieldOutline.getPropertyInfo().getName(false)); + } + + /** + * Returns the setProperty(...) method for the given field + * outline or null if no such method exists. + * + * @param fieldOutline + * field outline. + * @return The setProperty(...) method for the given field + * outline or null if no such method exists. + */ + public static JMethod setter(FieldOutline fieldOutline) { + + final JMethod getter = getter(fieldOutline); + final JType type = getter != null ? getter.type() : fieldOutline + .getRawType(); + final JDefinedClass theClass = fieldOutline.parent().implClass; + final String publicName = fieldOutline.getPropertyInfo().getName(true); + final String name = "set" + publicName; + return theClass.getMethod(name, new JType[] { type }); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java new file mode 100644 index 00000000..c29607b1 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/FieldUtils.java @@ -0,0 +1,163 @@ +package org.jvnet.jaxb2_commons.util; + +import javax.xml.namespace.QName; + +import com.sun.tools.xjc.generator.bean.ClassOutlineImpl; +import com.sun.tools.xjc.generator.bean.field.FieldRendererFactory; +import com.sun.tools.xjc.model.CAttributePropertyInfo; +import com.sun.tools.xjc.model.CCustomizations; +import com.sun.tools.xjc.model.CNonElement; +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.outline.FieldOutline; + +/** + * Field utilities. + * + * @author valikov + */ +public class FieldUtils { + + /** Hidden constructor. */ + private FieldUtils() { + } + + // + // public static FieldItem[] getFieldItems(ClassContext classContext) { + // final List fieldItems = (List) classContext.target + // .visit(new FieldGatheringVisitor(classContext)); + // return (FieldItem[]) fieldItems.toArray(new + // FieldItem[fieldItems.size()]); + // } + // + // public static String getFieldName(ClassContext classContext, FieldItem + // fieldItem) { + // return ClassUtils.getClassName(classContext.target) + "." + + // fieldItem.name; + // } + // + // public static String getFieldPropertyName(FieldItem fieldItem) { + // return fieldItem.name; + // } + // + // public static String getCommonFieldPropertyName(FieldItem fieldItem) { + // final String draftName = fieldItem.name; + // return Introspector.decapitalize(draftName); + // } + // + // public static FieldItem getFieldItem(FieldUse fieldUse) { + // if (fieldUse.items.isEmpty()) { + // return null; + // } + // else { + // return (FieldItem) fieldUse.items.iterator().next(); + // } + // } + // + // public static FieldUse getFieldUse(ClassContext classContext, FieldItem + // fieldItem) { + // return classContext.target.getField(fieldItem.name); + // } + // + // /** + // * Returns a new unique name of the field in the given class, based on the + // given prefix. If required, the prefix will + // * be appended with an integer to make it unique + // * + // * @param theClass class to create field in. + // * @param prefix field name prefix. + // * @return Unique name of the new field. + // */ + // public static String generateUniqueFieldName(final JDefinedClass + // theClass, final String prefix) { + // final String name; + // if (null == getField(theClass, prefix)) { + // name = prefix; + // } + // else { + // int index = 0; + // while (null != getField(theClass, prefix + index)) { + // index++; + // } + // name = prefix + index; + // } + // return name; + // } + // + // /** + // * Retrievs a named field of the given class. + // * + // * @param theClass class to search a field in. + // * @param name name of the field. + // * @return Requested field of the given class. + // */ + // public static JVar getField(final JDefinedClass theClass, final String + // name) { + // JFieldVar result = null; + // for (Iterator iterator = theClass.fields(); iterator.hasNext();) { + // final JFieldVar var = (JFieldVar) iterator.next(); + // if (name.equals(var.name())) { + // result = var; + // } + // } + // // todo : if not found??? + // return result; + // } + // + public static FieldOutline createAttributeField( + ClassOutlineImpl classOutline, String name, final QName attName, + final CNonElement typeInfo, final boolean required + // , + // final XSDatatype datatype, + // final JType type + ) { + + final CPropertyInfo propertyInfo = new CAttributePropertyInfo( + // name + name, + // source + null, new CCustomizations(), + // locator + null, + // attName + attName, + // typeUse + typeInfo, + // typeName + typeInfo.getTypeName(), + // required + required); + + propertyInfo.realization = new FieldRendererFactory().getDefault(); + final FieldOutline fieldOutline = + + propertyInfo.realization.generate(classOutline, propertyInfo); + + return fieldOutline; + + } + + // public static boolean isConstantField(ClassContext classContext, + // FieldItem fieldItem) { + // return AccessorUtils.get(classContext, fieldItem) == null; + // } + // + // public static FieldUse[] getFieldUses(final ClassItem classItem) { + // if (classItem.getSuperClass() == null) + // return classItem.getDeclaredFieldUses(); + // else { + // final FieldUse[] superFieldUses = + // FieldUtils.getFieldUses(classItem.getSuperClass()); + // final FieldUse[] declaredFieldUses = classItem.getDeclaredFieldUses(); + // final FieldUse[] fieldUses = new FieldUse[superFieldUses.length + + // declaredFieldUses.length]; + // System.arraycopy(superFieldUses, 0, fieldUses, 0, superFieldUses.length); + // System.arraycopy( + // declaredFieldUses, + // 0, + // fieldUses, + // superFieldUses.length, + // declaredFieldUses.length); + // return fieldUses; + // } + // } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java new file mode 100644 index 00000000..797ec481 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/GeneratorContextUtils.java @@ -0,0 +1,54 @@ +package org.jvnet.jaxb2_commons.util; + + +import org.jvnet.jaxb2_commons.xml.bind.ContextPathAware; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.tools.xjc.outline.Outline; + +public class GeneratorContextUtils { + + private GeneratorContextUtils() { + } + + public static JDefinedClass generateContextPathAwareClass( + Outline outline, + String name, + Class theClass) { + + return generateContextPathAwareClass(outline, name, theClass == null ? null : outline + .getCodeModel() + .ref(theClass)); + } + + public static JDefinedClass generateContextPathAwareClass( + Outline outline, + String name, + JClass baseClass) { + + final String contextPath = OutlineUtils.getContextPath(outline); + + final JCodeModel codeModel = outline.getCodeModel(); + final JDefinedClass contextPathAwareClass = CodeModelUtils.getOrCreateClass( + codeModel, + JMod.PUBLIC, + name); + + ClassUtils._implements(contextPathAwareClass, codeModel.ref(ContextPathAware.class)); + + if (baseClass != null) { + contextPathAwareClass._extends(baseClass); + } + + final JMethod getContextPath = contextPathAwareClass.method(JMod.PUBLIC, codeModel + .ref(String.class), "getContextPath"); + getContextPath.body()._return(JExpr.lit(contextPath)); + return contextPathAwareClass; + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java new file mode 100644 index 00000000..3822f4ab --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/OutlineUtils.java @@ -0,0 +1,44 @@ +package org.jvnet.jaxb2_commons.util; + +import java.util.Iterator; + +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; +import com.sun.tools.xjc.outline.PackageOutline; +import com.sun.xml.bind.api.impl.NameConverter; + +public class OutlineUtils { + + private OutlineUtils() { + } + + public static String getClassName(ClassOutline classOutline) { + return CodeModelUtils.getPackagedClassName(classOutline.implClass); + } + + public static String getFieldName(FieldOutline fieldOutline) { + return getClassName(fieldOutline.parent()) + "." + + fieldOutline.getPropertyInfo().getName(true); + } + + public static String getPropertyName(FieldOutline fieldOutline) { + return NameConverter.standard.toVariableName(fieldOutline + .getPropertyInfo().getName(true)); + } + + public static String getContextPath(Outline context) { + final StringBuilder sb = new StringBuilder(); + + for (final Iterator packageOutlines = context + .getAllPackageContexts().iterator(); packageOutlines.hasNext();) { + final PackageOutline packageOutline = packageOutlines.next(); + final String packageName = packageOutline._package().name(); + sb.append(packageName); + if (packageOutlines.hasNext()) + sb.append(':'); + } + return sb.toString(); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java new file mode 100644 index 00000000..5e46ea26 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/util/PropertyFieldAccessorFactory.java @@ -0,0 +1,218 @@ +package org.jvnet.jaxb2_commons.util; + +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JConditional; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JFieldVar; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JOp; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.outline.FieldAccessor; +import com.sun.tools.xjc.outline.FieldOutline; + +public class PropertyFieldAccessorFactory implements FieldAccessorFactory { + + public static FieldAccessorFactory INSTANCE = new PropertyFieldAccessorFactory(); + + public PropertyFieldAccessorFactory() { + + } + + public FieldAccessorEx createFieldAccessor(FieldOutline fieldOutline, + JExpression targetObject) { + return new PropertyFieldAccessor(fieldOutline, targetObject); + } + + private static class PropertyFieldAccessor implements FieldAccessorEx { + private static final JType[] ABSENT = new JType[0]; + private final FieldOutline fieldOutline; + private final JExpression targetObject; + private final JDefinedClass theClass; + private final JMethod isSetter; + private final JMethod unSetter; + private final JMethod getter; + private final JMethod setter; + private final JFieldVar constantField; + private FieldAccessor fieldAccessor; + private final JType type; + + public PropertyFieldAccessor(final FieldOutline fieldOutline, + JExpression targetObject) { + super(); + this.fieldOutline = fieldOutline; + this.targetObject = targetObject; + this.fieldAccessor = fieldOutline.create(targetObject); + final String publicName = fieldOutline.getPropertyInfo().getName( + true); + this.theClass = fieldOutline.parent().implClass; + final String setterName = "set" + publicName; + final JMethod getGetter = theClass.getMethod("get" + publicName, + ABSENT); + final JMethod isGetter = theClass.getMethod("is" + publicName, + ABSENT); + this.getter = getGetter != null ? getGetter + : (isGetter != null ? isGetter : null); + this.type = this.getter != null ? this.getter.type() : fieldOutline + .getRawType(); + + final JFieldVar field = theClass.fields().get(publicName); + this.constantField = field != null + && ((field.mods().getValue() & JMod.PUBLIC) != 0) + && ((field.mods().getValue() & JMod.STATIC) != 0) + && ((field.mods().getValue() & JMod.FINAL) != 0) ? field + : null; + // fieldOutline.getRawType(); + final JType rawType = fieldOutline.getRawType(); + final JMethod boxifiedSetter = theClass.getMethod(setterName, + new JType[] { rawType.boxify() }); + final JMethod unboxifiedSetter = theClass.getMethod(setterName, + new JType[] { rawType.unboxify() }); + this.setter = boxifiedSetter != null ? boxifiedSetter + : unboxifiedSetter; + this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT); + this.unSetter = theClass.getMethod("unset" + publicName, ABSENT); + } + + public JType getType() { + return type; + } + + public boolean isVirtual() { + return constantField != null; + } + + public boolean isConstant() { + return constantField != null; + } + + public FieldOutline owner() { + return fieldOutline; + } + + public CPropertyInfo getPropertyInfo() { + return fieldOutline.getPropertyInfo(); + } + + public boolean isAlwaysSet() { + if (constantField != null) { + return true; + } else { + return JExpr.TRUE == fieldAccessor.hasSetValue(); + } + } + + public JExpression hasSetValue() { + if (constantField != null) { + return JExpr.TRUE; + } else if (isSetter != null) { + return targetObject.invoke(isSetter); + } else { + return fieldAccessor.hasSetValue(); + } + } + + public void unsetValues(JBlock body) { + if (constantField != null) { + + } else if (unSetter != null) { + body.invoke(targetObject, unSetter); + } else { + + fieldAccessor.unsetValues(body); + } + } + + public void fromRawValue(JBlock block, String uniqueName, + JExpression $var) { + if (constantField != null) { + + } else if (setter != null) { + block.invoke(targetObject, setter).arg($var); + } else { + unsetValues(block); + if (fieldOutline.getPropertyInfo().isCollection()) { + fieldAccessor.fromRawValue(block + ._if($var.ne(JExpr._null()))._then(), uniqueName, + $var); + } else { + fieldAccessor.fromRawValue(block, uniqueName, $var); + } + } + } + + public void toRawValue(JBlock block, JVar $var) { + if (constantField != null) { + block.assign($var, theClass.staticRef(this.constantField)); + } else if (type.isPrimitive() + || fieldOutline.getPropertyInfo().isCollection()) { + final JExpression defaultExpression; + if (type.isPrimitive()) { + if (type.fullName().equals(type.owner().BOOLEAN.fullName())) { + defaultExpression = JExpr.FALSE; + } else if (type.fullName().equals( + type.owner().BYTE.fullName())) { + final byte value = 0; + defaultExpression = JExpr.lit(value); + } else if (type.fullName().equals( + type.owner().CHAR.fullName())) { + final char value = 0; + defaultExpression = JExpr.lit(value); + } else if (type.fullName().equals( + type.owner().DOUBLE.fullName())) { + final double value = 0; + defaultExpression = JExpr.lit(value); + } else if (type.fullName().equals( + type.owner().FLOAT.fullName())) { + final float value = 0; + defaultExpression = JExpr.lit(value); + } else if (type.fullName().equals( + type.owner().INT.fullName())) { + final int value = 0; + defaultExpression = JExpr.lit(value); + } else if (type.fullName().equals( + type.owner().LONG.fullName())) { + final long value = 0; + defaultExpression = JExpr.lit(value); + } else if (type.fullName().equals( + type.owner().SHORT.fullName())) { + final short value = 0; + defaultExpression = JExpr.lit(value); + } else { + throw new UnsupportedOperationException(); + } + + } else if (fieldOutline.getPropertyInfo().isCollection()) { + defaultExpression = JExpr._null(); + } else { + throw new UnsupportedOperationException(); + } + if (getter != null) { + if (isAlwaysSet()) { + block.assign($var, targetObject.invoke(getter)); + } else { + block.assign($var, JOp.cond(hasSetValue(), + targetObject.invoke(getter), defaultExpression)); + } + } else { + final JConditional _if = block._if(hasSetValue()); + fieldAccessor.toRawValue(_if._then(), $var); + _if._else().assign($var, defaultExpression); + } + } else { + if (getter != null) { + block.assign($var, targetObject.invoke(getter)); + } else { + fieldAccessor.toRawValue(block, $var); + } + } + } + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java new file mode 100644 index 00000000..2fc1906b --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MClassOutlineGenerator.java @@ -0,0 +1,16 @@ +package org.jvnet.jaxb2_commons.xjc.generator; + +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MClassOutlineGenerator { + + public MClassOutline generate(MPackageOutline parent, MModelInfo modelInfo, + MClassInfo classInfo); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java new file mode 100644 index 00000000..452276c3 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MElementOutlineGenerator.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.xjc.generator; + +import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MElementOutlineGenerator { + + public MElementOutline generate(MPackageOutline parent, + MModelInfo modelInfo, + MElementInfo elementInfo); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java new file mode 100644 index 00000000..727601c5 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumConstantOutlineGenerator.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.xjc.generator; + +import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MEnumConstantOutlineGenerator { + + public MEnumConstantOutline generate(MEnumOutline parent, + MModelInfo modelInfo, + MEnumConstantInfo enumConstantInfo); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java new file mode 100644 index 00000000..a54c226b --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MEnumOutlineGenerator.java @@ -0,0 +1,16 @@ +package org.jvnet.jaxb2_commons.xjc.generator; + +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MEnumOutlineGenerator { + + public MEnumOutline generate(MPackageOutline parent, + MModelInfo modelInfo, + MEnumLeafInfo enumLeafInfo); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java new file mode 100644 index 00000000..657c2930 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MModelOutlineGenerator.java @@ -0,0 +1,13 @@ +package org.jvnet.jaxb2_commons.xjc.generator; + +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MModelOutlineGenerator { + + public MModelOutline generate(MModelInfo modelInfo); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java new file mode 100644 index 00000000..c9a9bb3e --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MObjectFactoryOutlineGenerator.java @@ -0,0 +1,16 @@ +package org.jvnet.jaxb2_commons.xjc.generator; + +import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MObjectFactoryOutlineGenerator { + + public MObjectFactoryOutline generate(MPackageOutline parent, + MModelInfo modelInfo, MPackageInfo packageInfo); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java new file mode 100644 index 00000000..0525091e --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPackageOutlineGenerator.java @@ -0,0 +1,16 @@ +package org.jvnet.jaxb2_commons.xjc.generator; + +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MPackageOutlineGenerator { + + public MPackageOutline generate(MModelOutline parent, + MModelInfo modelInfo, MPackageInfo packageInfo); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java new file mode 100644 index 00000000..c07330ee --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/MPropertyOutlineGenerator.java @@ -0,0 +1,16 @@ +package org.jvnet.jaxb2_commons.xjc.generator; + +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MPropertyOutlineGenerator { + + public MPropertyOutline generate(MClassOutline classOutline, + MModelInfo modelInfo, + MPropertyInfo propertyInfo); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java new file mode 100644 index 00000000..f395c8e3 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/artificial/WrapperPropertyOutlineGenerator.java @@ -0,0 +1,33 @@ +package org.jvnet.jaxb2_commons.xjc.generator.artificial; + +import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.codemodel.JExpression; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class WrapperPropertyOutlineGenerator implements + MPropertyOutlineGenerator { + + public MPropertyOutline generate(MClassOutline classOutline, + MModelInfo modelInfo, + MPropertyInfo propertyInfo) { + return new CMPropertyOutline(classOutline, propertyInfo, + new MPropertyAccessorFactory() { + + public MPropertyAccessor createPropertyAccessor( + JExpression target) { + // TODO + throw new UnsupportedOperationException(); + } + }); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java new file mode 100644 index 00000000..50b2b828 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMClassOutlineGenerator.java @@ -0,0 +1,83 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMClassOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.ClassOutline; +import com.sun.tools.xjc.outline.Outline; + +public class CMClassOutlineGenerator implements MClassOutlineGenerator { + + private final Outline outline; + + private final CClassInfo classInfo; + + public CMClassOutlineGenerator(Outline outline, CClassInfo classInfo) { + Validate.notNull(outline); + Validate.notNull(classInfo); + this.outline = outline; + this.classInfo = classInfo; + } + + public MClassOutline generate(final MPackageOutline parent, + MModelInfo modelInfo, + MClassInfo classInfo) { + + ClassOutline co = outline.getClazz(this.classInfo); + + final MClassOutline superClassOutline; + if (classInfo.getBaseTypeInfo() != null) { + superClassOutline = classInfo + .getBaseTypeInfo() + .acceptClassTypeInfoVisitor( + new MClassTypeInfoVisitor() { + @Override + public MClassOutline visitClassInfo( + MClassInfo info) { + return parent.getParent().getClassOutline( + info); + } + + @Override + public MClassOutline visitClassRef( + MClassRef info) { + return null; + } + }); + } else { + superClassOutline = null; + } + + final CMClassOutline classOutline = new CMClassOutline( + parent.getParent(), parent, classInfo, superClassOutline, + co.ref, co.implClass, co.implRef); + + for (MPropertyInfo propertyInfo : classInfo + .getProperties()) { + if (propertyInfo.getOrigin() instanceof PropertyOutlineGeneratorFactory) { + final MPropertyOutlineGenerator generator = ((PropertyOutlineGeneratorFactory) propertyInfo + .getOrigin()).createGenerator(outline); + final MPropertyOutline propertyOutline = generator.generate( + classOutline, modelInfo, propertyInfo); + if (propertyOutline != null) { + classOutline.addDeclaredPropertyOutline(propertyOutline); + } + } + } + return classOutline; + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java new file mode 100644 index 00000000..63800bbf --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMElementOutlineGenerator.java @@ -0,0 +1,42 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMElementOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; + +import com.sun.tools.xjc.model.CElementInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.ElementOutline; +import com.sun.tools.xjc.outline.Outline; + +public class CMElementOutlineGenerator implements MElementOutlineGenerator { + + private final Outline outline; + private final CElementInfo elementInfo; + + public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) { + Validate.notNull(outline); + Validate.notNull(elementInfo); + this.outline = outline; + this.elementInfo = elementInfo; + } + + public MElementOutline generate(MPackageOutline parent, + MModelInfo modelInfo, + MElementInfo elementInfo) { + final ElementOutline elementOutline = outline + .getElement(this.elementInfo); + if (elementOutline != null) { + return new CMElementOutline(parent.getParent(), parent, + elementInfo, elementOutline.implClass); + } else { + return null; + } + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java new file mode 100644 index 00000000..53285ae3 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumConstantOutlineGenerator.java @@ -0,0 +1,50 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumConstantOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; + +import com.sun.tools.xjc.model.CEnumConstant; +import com.sun.tools.xjc.model.CEnumLeafInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.EnumConstantOutline; +import com.sun.tools.xjc.outline.EnumOutline; +import com.sun.tools.xjc.outline.Outline; + +public class CMEnumConstantOutlineGenerator implements + MEnumConstantOutlineGenerator { + + private final Outline outline; + private final CEnumConstant enumConstant; + + public CMEnumConstantOutlineGenerator(Outline outline, + CEnumConstant enumConstant) { + Validate.notNull(outline); + Validate.notNull(enumConstant); + this.outline = outline; + this.enumConstant = enumConstant; + } + + public MEnumConstantOutline generate(MEnumOutline parent, + MModelInfo modelInfo, + MEnumConstantInfo enumConstantInfo) { + + final CEnumLeafInfo eli = enumConstant.getEnclosingClass(); + + final EnumOutline enumOutline = outline.getEnum(eli); + + for (EnumConstantOutline enumConstantOutline : enumOutline.constants) { + if (enumConstantOutline.target == enumConstant) { + return new CMEnumConstantOutline(parent, enumConstantInfo, + enumConstantOutline.constRef); + } + } + return null; + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java new file mode 100644 index 00000000..faccaf04 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMEnumOutlineGenerator.java @@ -0,0 +1,56 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMEnumOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; + +import com.sun.tools.xjc.model.CEnumLeafInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.EnumOutline; +import com.sun.tools.xjc.outline.Outline; + +public class CMEnumOutlineGenerator implements MEnumOutlineGenerator { + + private final Outline outline; + private final CEnumLeafInfo enumLeafInfo; + + public CMEnumOutlineGenerator(Outline outline, CEnumLeafInfo enumLeafInfo) { + Validate.notNull(outline); + Validate.notNull(enumLeafInfo); + this.outline = outline; + this.enumLeafInfo = enumLeafInfo; + } + + public MEnumOutline generate(MPackageOutline parent, + MModelInfo modelInfo, + MEnumLeafInfo enumLeafInfo) { + final EnumOutline eo = outline.getEnum(this.enumLeafInfo); + + final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(), + parent, enumLeafInfo, eo.clazz); + + for (MEnumConstantInfo enumConstantInfo : enumLeafInfo + .getConstants()) { + + if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) { + final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo + .getOrigin()).createGenerator(outline); + final MEnumConstantOutline enumConstantOutline = generator + .generate(enumOutline, modelInfo, enumConstantInfo); + if (enumConstantOutline != null) { + enumOutline.addEnumConstantOutline(enumConstantOutline); + } + } + } + return enumOutline; + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java new file mode 100644 index 00000000..da739589 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMModelOutlineGenerator.java @@ -0,0 +1,159 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMModelOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; + +import com.sun.tools.xjc.model.Model; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class CMModelOutlineGenerator implements MModelOutlineGenerator { + + private final Outline outline; + private final Model model; + + public CMModelOutlineGenerator(Outline outline, Model model) { + Validate.notNull(outline); + Validate.notNull(model); + this.outline = outline; + this.model = model; + } + + public MModelOutline generate(MModelInfo modelInfo) { + + final CMModelOutline modelOutline = new CMModelOutline(modelInfo, + outline.getCodeModel()); + + for (MClassInfo classInfo : modelInfo.getClassInfos()) { + generatePackageOutline(modelOutline, modelInfo, + classInfo.getPackageInfo()); + } + + for (MElementInfo elementInfo : modelInfo + .getElementInfos()) { + generatePackageOutline(modelOutline, modelInfo, + elementInfo.getPackageInfo()); + } + + for (MEnumLeafInfo enumLeafInfo : modelInfo + .getEnumLeafInfos()) { + generatePackageOutline(modelOutline, modelInfo, + enumLeafInfo.getPackageInfo()); + } + + for (MClassInfo classInfo : modelInfo.getClassInfos()) { + generateClassOutline(modelOutline, modelInfo, classInfo); + } + + for (MElementInfo elementInfo : modelInfo + .getElementInfos()) { + generateElementOutline(modelOutline, modelInfo, elementInfo); + } + + for (MEnumLeafInfo enumLeafInfo : modelInfo + .getEnumLeafInfos()) { + generateEnumOutline(modelOutline, modelInfo, enumLeafInfo); + } + + // TODO Auto-generated method stub + return modelOutline; + } + + private void generatePackageOutline(CMModelOutline modelOutline, + MModelInfo modelInfo, MPackageInfo packageInfo) { + if (modelOutline.getPackageOutline(packageInfo) == null && + + packageInfo.getOrigin() instanceof PackageOutlineGeneratorFactory) { + final MPackageOutlineGenerator generator = ((PackageOutlineGeneratorFactory) packageInfo + .getOrigin()).createGenerator(outline); + final MPackageOutline packageOutline = generator.generate( + modelOutline, modelInfo, packageInfo); + modelOutline.addPackageOutline(packageOutline); + + } + } + + private void generateClassOutline(final CMModelOutline modelOutline, + final MModelInfo modelInfo, + MClassInfo classInfo) { + if (classInfo.getBaseTypeInfo() != null) { + classInfo.getBaseTypeInfo().acceptClassTypeInfoVisitor( + new MClassTypeInfoVisitor() { + @Override + public Void visitClassInfo( + MClassInfo info) { + generateClassOutline(modelOutline, modelInfo, info); + return null; + } + + @Override + public Void visitClassRef(MClassRef info) { + return null; + } + }); + } + + if (classInfo.getOrigin() instanceof ClassOutlineGeneratorFactory) { + final MClassOutlineGenerator generator = ((ClassOutlineGeneratorFactory) classInfo + .getOrigin()).createGenerator(this.outline); + final MClassOutline classOutline = generator.generate( + modelOutline.getPackageOutline(classInfo.getPackageInfo()), + modelInfo, classInfo); + if (classOutline != null) { + modelOutline.addClassOutline(classOutline); + } + } + } + + private void generateElementOutline(CMModelOutline modelOutline, + MModelInfo modelInfo, + MElementInfo elementInfo) + + { + if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) { + final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo + .getOrigin()).createGenerator(outline); + final MElementOutline elementOutline = generator + .generate(modelOutline.getPackageOutline(elementInfo + .getPackageInfo()), modelInfo, elementInfo); + if (elementOutline != null) { + modelOutline.addElementOutline(elementOutline); + } + } + } + + private void generateEnumOutline(CMModelOutline modelOutline, + MModelInfo modelInfo, + MEnumLeafInfo enumLeafInfo) + + { + if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) { + final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo + .getOrigin()).createGenerator(outline); + final MEnumOutline enumOutline = generator.generate(modelOutline + .getPackageOutline(enumLeafInfo.getPackageInfo()), + modelInfo, enumLeafInfo); + if (enumOutline != null) { + modelOutline.addEnumOutline(enumOutline); + } + } + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java new file mode 100644 index 00000000..89aebe76 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPackageOutlineGenerator.java @@ -0,0 +1,38 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; + +import com.sun.codemodel.JPackage; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; +import com.sun.tools.xjc.outline.PackageOutline; + +public class CMPackageOutlineGenerator implements MPackageOutlineGenerator { + + private final Outline outline; + + private final JPackage packageInfo; + + public CMPackageOutlineGenerator(Outline outline, JPackage packageInfo) { + Validate.notNull(outline); + Validate.notNull(packageInfo); + this.outline = outline; + this.packageInfo = packageInfo; + } + + public MPackageOutline generate(MModelOutline parent, + MModelInfo modelInfo, MPackageInfo packageInfo) { + final PackageOutline packageOutline = outline + .getPackageContext(this.packageInfo); + Validate.notNull(packageOutline); + return new CMPackageOutline(parent, packageInfo, packageOutline); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java new file mode 100644 index 00000000..c73934b0 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/CMPropertyOutlineGenerator.java @@ -0,0 +1,49 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; +import org.jvnet.jaxb2_commons.util.PropertyFieldAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.concrete.CMPropertyOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.FieldOutline; +import com.sun.tools.xjc.outline.Outline; + +public class CMPropertyOutlineGenerator implements MPropertyOutlineGenerator { + + private final Outline outline; + + private final CPropertyInfo propertyInfo; + + private final FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE; + + public CMPropertyOutlineGenerator(Outline outline, + CPropertyInfo propertyInfo) { + Validate.notNull(outline); + Validate.notNull(propertyInfo); + this.outline = outline; + this.propertyInfo = propertyInfo; + } + + public MPropertyOutline generate(MClassOutline classOutline, + MModelInfo modelInfo, + MPropertyInfo propertyInfo) { + + final FieldOutline fieldOutline = outline.getField(this.propertyInfo); + + final MPropertyAccessorFactory propertyAccessorFactory = new CMPropertyAccessorFactory( + this.fieldAccessorFactory, fieldOutline); + return new CMPropertyOutline(classOutline, propertyInfo, + propertyAccessorFactory); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java new file mode 100644 index 00000000..2c51452a --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ClassOutlineGeneratorFactory.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; + +public interface ClassOutlineGeneratorFactory extends + OutlineGeneratorFactory { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java new file mode 100644 index 00000000..c8f3d734 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ElementOutlineGeneratorFactory.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; + +public interface ElementOutlineGeneratorFactory extends + OutlineGeneratorFactory { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java new file mode 100644 index 00000000..79419eed --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumConstantOutlineGeneratorFactory.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; + +public interface EnumConstantOutlineGeneratorFactory extends + OutlineGeneratorFactory { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java new file mode 100644 index 00000000..7d2710fd --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/EnumOutlineGeneratorFactory.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; + +public interface EnumOutlineGeneratorFactory extends + OutlineGeneratorFactory { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java new file mode 100644 index 00000000..3ef9285a --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/ModelOutlineGeneratorFactory.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; + +public interface ModelOutlineGeneratorFactory extends + OutlineGeneratorFactory { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java new file mode 100644 index 00000000..e67d8727 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/OutlineGeneratorFactory.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import com.sun.tools.xjc.outline.Outline; + +public interface OutlineGeneratorFactory { + + public G createGenerator(Outline outline); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java new file mode 100644 index 00000000..30cdb06d --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PackageOutlineGeneratorFactory.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; + +public interface PackageOutlineGeneratorFactory extends + OutlineGeneratorFactory { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java new file mode 100644 index 00000000..561df08f --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/generator/concrete/PropertyOutlineGeneratorFactory.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xjc.generator.concrete; + +import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; + +public interface PropertyOutlineGeneratorFactory extends + OutlineGeneratorFactory { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java new file mode 100644 index 00000000..695ad2c5 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/XJCCMInfoFactory.java @@ -0,0 +1,394 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete; + +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; + +import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMClassInfoOrigin; +import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMElementInfoOrigin; +import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumConstantInfoOrigin; +import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMEnumLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMModelInfoOrigin; +import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPackageInfoOrigin; +import org.jvnet.jaxb2_commons.xjc.model.concrete.origin.XJCCMPropertyInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassRef; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MContainer; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTypeInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMClassRef; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMInfoFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.CMPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MClassInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumConstantInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MEnumLeafInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MModelInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPackageInfoOrigin; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JPackage; +import com.sun.tools.xjc.model.CAttributePropertyInfo; +import com.sun.tools.xjc.model.CBuiltinLeafInfo; +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.CClassInfoParent; +import com.sun.tools.xjc.model.CClassInfoParent.Visitor; +import com.sun.tools.xjc.model.CClassRef; +import com.sun.tools.xjc.model.CElementInfo; +import com.sun.tools.xjc.model.CElementPropertyInfo; +import com.sun.tools.xjc.model.CEnumConstant; +import com.sun.tools.xjc.model.CEnumLeafInfo; +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.model.CReferencePropertyInfo; +import com.sun.tools.xjc.model.CTypeInfo; +import com.sun.tools.xjc.model.CValuePropertyInfo; +import com.sun.tools.xjc.model.CWildcardTypeInfo; +import com.sun.tools.xjc.model.Model; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Aspect; +import com.sun.tools.xjc.outline.Outline; + +public class XJCCMInfoFactory + extends + CMInfoFactory { + + private final Map> classRefs = + + new IdentityHashMap>(); + + public XJCCMInfoFactory(Model model) { + super(model); + } + + protected NClass getClazz(CClassRef info) { + return info; + } + + protected NClass getClazz(final Class _clas) { + return new NClass() { + + @Override + public boolean isBoxedType() { + return false; + } + + @Override + public String fullName() { + return _clas.getName(); + } + + @Override + public JClass toType(Outline o, Aspect aspect) { + return o.getCodeModel().ref(_clas); + } + + @Override + public boolean isAbstract() { + return false; + } + }; + } + + protected NClass getClazz(final String className) { + return new NClass() { + + @Override + public boolean isBoxedType() { + return false; + } + + @Override + public String fullName() { + return className; + } + + @Override + public JClass toType(Outline o, Aspect aspect) { + return o.getCodeModel().ref(className); + } + + @Override + public boolean isAbstract() { + return false; + } + }; + } + + protected MClassRef createClassRef(Class _class) { + return new CMClassRef(getClazz(_class), + getPackage(_class), getContainer(_class), getLocalName(_class)); + } + + protected MClassRef getTypeInfo(CClassRef info) { + + MClassRef classInfo = classRefs.get(info); + + if (classInfo == null) { + + classInfo = createClassRef(info); + classRefs.put(info, classInfo); + } + return classInfo; + } + + protected MClassRef createClassRef(CClassRef info) { + return new CMClassRef(getClazz(info), getPackage(info), + getContainer(info), getLocalName(info)); + } + + @Override + protected MTypeInfo getTypeInfo(CTypeInfo typeInfo) { + if (typeInfo instanceof CClassRef) { + return getTypeInfo((CClassRef) typeInfo); + } else { + return super.getTypeInfo(typeInfo); + } + } + + @Override + protected MPackageInfo getPackage(CClassInfo info) { + return getPackage(info.parent()); + } + + protected MPackageInfo getPackage(CClassRef info) { + final String fullName = info.fullName(); + return getPackage(fullName); + } + + private MPackageInfo getPackage(final String fullName) { + try { + final Class _class = Class.forName(fullName); + return getPackage(_class); + } catch (ClassNotFoundException cnfex) { + final String packageName; + final int lastIndexOfDot = fullName.lastIndexOf('.'); + if (lastIndexOfDot != -1) { + packageName = fullName.substring(0, lastIndexOfDot); + } else { + packageName = ""; + } + return new CMPackageInfo(new CMPackageInfoOrigin(), packageName); + } + } + + private MPackageInfo getPackage(final Class _class) { + final Package _package = _class.getPackage(); + return new CMPackageInfo(new CMPackageInfoOrigin(), _package.getName()); + } + + @Override + protected MPackageInfo getPackage(CEnumLeafInfo info) { + return getPackage(info.parent); + } + + @Override + protected MPackageInfo getPackage(CElementInfo info) { + return getPackage(info.parent); + } + + @Override + protected MContainer getContainer(CClassInfo info) { + final CClassInfoParent parent = info.parent(); + return parent == null ? null : getContainer(parent); + } + + @Override + protected MContainer getContainer(CElementInfo info) { + final CClassInfoParent parent = info.parent; + return parent == null ? null : getContainer(parent); + } + + @Override + protected MContainer getContainer(CEnumLeafInfo info) { + final CClassInfoParent parent = info.parent; + return parent == null ? null : getContainer(parent); + } + + protected MContainer getContainer(CClassRef info) { + final String fullName = info.fullName(); + try { + final Class _class = Class.forName(fullName); + return getContainer(_class); + } catch (ClassNotFoundException cnfex) { + return getPackage(info); + } + } + + private MContainer getContainer(final Class _class) { + final Class enclosingClass = _class.getEnclosingClass(); + if (enclosingClass == null) { + return getPackage(_class); + } else { + return createClassRef(enclosingClass); + } + } + + private final Map packages = new HashMap(); + + private MContainer getContainer(CClassInfoParent parent) { + return parent.accept(new Visitor() { + + public MContainer onBean(CClassInfo bean) { + return getTypeInfo(bean); + } + + public MContainer onPackage(JPackage pkg) { + return getPackage(pkg); + } + + public MContainer onElement(CElementInfo element) { + return getElementInfo(element); + } + }); + } + + private MPackageInfo getPackage(CClassInfoParent parent) { + + return parent.accept(new Visitor() { + + public MPackageInfo onBean(CClassInfo bean) { + return getPackage(bean.parent()); + } + + public MPackageInfo onPackage(JPackage pkg) { + return getPackage(pkg); + } + + public MPackageInfo onElement(CElementInfo element) { + return getPackage(element.parent); + } + }); + + } + + @Override + protected MClassInfo getScope(CClassInfo info) { + return info.getScope() == null ? null : getTypeInfo(info.getScope()); + } + + @Override + protected String getLocalName(CClassInfo info) { + return info.shortName; + } + + protected String getLocalName(CClassRef info) { + final String fullName = info.fullName(); + try { + final Class _class = Class.forName(fullName); + return getLocalName(_class); + } catch (ClassNotFoundException cnfex) { + return getLocalName(fullName); + } + } + + private String getLocalName(final String fullName) { + final int lastIndexOfDollar = fullName.lastIndexOf('$'); + if (lastIndexOfDollar != -1) { + return fullName.substring(lastIndexOfDollar + 1); + } + final int lastIndexOfDot = fullName.lastIndexOf('.'); + if (lastIndexOfDot != -1) { + return fullName.substring(lastIndexOfDot + 1); + } + return fullName; + } + + private String getLocalName(final Class _class) { + return _class.getSimpleName(); + } + + @Override + protected String getLocalName(CEnumLeafInfo info) { + return info.shortName; + } + + @Override + protected String getLocalName(CElementInfo info) { + return info.shortName(); + } + + @Override + protected MModelInfoOrigin createModelInfoOrigin(Model info) { + return new XJCCMModelInfoOrigin(info); + } + + protected MPackageInfoOrigin createPackageInfoOrigin(JPackage info) { + return new XJCCMPackageInfoOrigin(info); + } + + protected MClassInfoOrigin createClassInfoOrigin(CClassInfo info) { + return new XJCCMClassInfoOrigin(info); + } + + @Override + protected MPropertyInfoOrigin createPropertyInfoOrigin(CPropertyInfo info) { + return new XJCCMPropertyInfoOrigin(info); + } + + @Override + protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) { + return new XJCCMElementInfoOrigin(info); + } + + @Override + protected MEnumLeafInfoOrigin createEnumLeafInfoOrigin(CEnumLeafInfo info) { + return new XJCCMEnumLeafInfoOrigin(info); + } + + @Override + protected MEnumConstantInfoOrigin createEnumConstantInfoOrigin( + CEnumConstant info) { + return new XJCCMEnumConstantInfoOrigin(info); + } + + @Override + protected NType createListType(final NType elementType) { + + return new NClass() { + + public boolean isBoxedType() { + return false; + } + + public String fullName() { + return List.class.getName(); + } + + public JClass toType(Outline o, Aspect aspect) { + return o.getCodeModel().ref(List.class) + .narrow(elementType.toType(o, aspect).boxify()); + } + + public boolean isAbstract() { + return false; + } + }; + } + + private MPackageInfo getPackage(JPackage pkg) { + String packageName = pkg.name(); + MPackageInfo _package = packages.get(packageName); + if (_package == null) { + _package = new CMPackageInfo(createPackageInfoOrigin(pkg), + packageName); + packages.put(packageName, _package); + } + return _package; + } + + @Override + protected MClassTypeInfo createBaseTypeInfo(CClassInfo info) { + if (info.getBaseClass() != null) { + return getTypeInfo(info.getBaseClass()); + } else if (info.getRefBaseClass() != null) { + return getTypeInfo(info.getRefBaseClass()); + } else { + return null; + } + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java new file mode 100644 index 00000000..885f2a9f --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DefaultPropertyInfoOrigin.java @@ -0,0 +1,23 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.lang.Validate; +import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +import com.sun.tools.xjc.outline.Outline; + +public class DefaultPropertyInfoOrigin implements MPropertyInfoOrigin, + PropertyOutlineGeneratorFactory { + + private final MPropertyOutlineGenerator generator; + + public DefaultPropertyInfoOrigin(MPropertyOutlineGenerator generator) { + Validate.notNull(generator); + this.generator = generator; + } + + public MPropertyOutlineGenerator createGenerator(Outline outline) { + return generator; + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java new file mode 100644 index 00000000..178829fd --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/DummyPropertyInfoOrigin.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; + +public class DummyPropertyInfoOrigin implements MPropertyInfoOrigin { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java new file mode 100644 index 00000000..1cee3ff9 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/PackageInfoOrigin.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xml.bind.model.MSourced; + +import com.sun.codemodel.JPackage; + +public interface PackageInfoOrigin extends MSourced { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java new file mode 100644 index 00000000..4dfdab28 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMClassInfoOrigin.java @@ -0,0 +1,25 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xjc.generator.MClassOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMClassOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.ClassOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMClassInfoOrigin; + +import com.sun.tools.xjc.model.CClassInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class XJCCMClassInfoOrigin extends + CMClassInfoOrigin implements + ClassOutlineGeneratorFactory { + + public XJCCMClassInfoOrigin(CClassInfo source) { + super(source); + } + + public MClassOutlineGenerator createGenerator(Outline outline) { + return new CMClassOutlineGenerator(outline, getSource()); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java new file mode 100644 index 00000000..99dc0e5c --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMElementInfoOrigin.java @@ -0,0 +1,25 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xjc.generator.MElementOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMElementOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.ElementOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMElementInfoOrigin; + +import com.sun.tools.xjc.model.CElementInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class XJCCMElementInfoOrigin extends + CMElementInfoOrigin implements + ElementOutlineGeneratorFactory { + + public XJCCMElementInfoOrigin(CElementInfo source) { + super(source); + } + + public MElementOutlineGenerator createGenerator(Outline outline) { + return new CMElementOutlineGenerator(outline, getSource()); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java new file mode 100644 index 00000000..5e18d4e5 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumConstantInfoOrigin.java @@ -0,0 +1,24 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xjc.generator.MEnumConstantOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumConstantOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumConstantOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumConstantInfoOrigin; + +import com.sun.tools.xjc.model.CEnumConstant; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class XJCCMEnumConstantInfoOrigin extends + CMEnumConstantInfoOrigin implements + EnumConstantOutlineGeneratorFactory { + + public XJCCMEnumConstantInfoOrigin(CEnumConstant source) { + super(source); + } + + public MEnumConstantOutlineGenerator createGenerator(Outline outline) { + return new CMEnumConstantOutlineGenerator(outline, getSource()); + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java new file mode 100644 index 00000000..88c99092 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMEnumLeafInfoOrigin.java @@ -0,0 +1,24 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xjc.generator.MEnumOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMEnumOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.EnumOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMEnumLeafInfoOrigin; + +import com.sun.tools.xjc.model.CEnumLeafInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class XJCCMEnumLeafInfoOrigin extends + CMEnumLeafInfoOrigin implements + EnumOutlineGeneratorFactory { + + public XJCCMEnumLeafInfoOrigin(CEnumLeafInfo source) { + super(source); + } + + public MEnumOutlineGenerator createGenerator(Outline outline) { + return new CMEnumOutlineGenerator(outline, getSource()); + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java new file mode 100644 index 00000000..cf8dc8e1 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMModelInfoOrigin.java @@ -0,0 +1,25 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xjc.generator.MModelOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMModelOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.ModelOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMModelInfoOrigin; + +import com.sun.tools.xjc.model.Model; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class XJCCMModelInfoOrigin extends + CMModelInfoOrigin implements + ModelOutlineGeneratorFactory { + + public XJCCMModelInfoOrigin(Model source) { + super(source); + } + + public MModelOutlineGenerator createGenerator(Outline outline) { + return new CMModelOutlineGenerator(outline, getSource()); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java new file mode 100644 index 00000000..389402d7 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPackageInfoOrigin.java @@ -0,0 +1,30 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.generator.MPackageOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPackageOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.PackageOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPackageInfoOrigin; + +import com.sun.codemodel.JPackage; +import com.sun.tools.xjc.outline.Outline; + +public class XJCCMPackageInfoOrigin extends CMPackageInfoOrigin implements + PackageInfoOrigin, PackageOutlineGeneratorFactory { + + private final JPackage source; + + public XJCCMPackageInfoOrigin(JPackage source) { + Validate.notNull(source); + this.source = source; + } + + public JPackage getSource() { + return source; + } + + public MPackageOutlineGenerator createGenerator(Outline outline) { + return new CMPackageOutlineGenerator(outline, getSource()); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java new file mode 100644 index 00000000..091edcc1 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/model/concrete/origin/XJCCMPropertyInfoOrigin.java @@ -0,0 +1,25 @@ +package org.jvnet.jaxb2_commons.xjc.model.concrete.origin; + +import org.jvnet.jaxb2_commons.xjc.generator.MPropertyOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.CMPropertyOutlineGenerator; +import org.jvnet.jaxb2_commons.xjc.generator.concrete.PropertyOutlineGeneratorFactory; +import org.jvnet.jaxb2_commons.xml.bind.model.concrete.origin.CMPropertyInfoOrigin; + +import com.sun.tools.xjc.model.CPropertyInfo; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class XJCCMPropertyInfoOrigin extends + CMPropertyInfoOrigin implements + PropertyOutlineGeneratorFactory { + + public XJCCMPropertyInfoOrigin(CPropertyInfo source) { + super(source); + } + + public MPropertyOutlineGenerator createGenerator(Outline outline) { + return new CMPropertyOutlineGenerator(outline, getSource()); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java new file mode 100644 index 00000000..b78d4f01 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/FieldAccessorEx.java @@ -0,0 +1,15 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import com.sun.codemodel.JType; +import com.sun.tools.xjc.outline.FieldAccessor; + +public interface FieldAccessorEx extends FieldAccessor { + + public JType getType(); + + public boolean isConstant(); + + public boolean isVirtual(); + + public boolean isAlwaysSet(); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java new file mode 100644 index 00000000..ca86fffe --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MChildOutline.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +public interface MChildOutline { + + public MModelOutline getParent(); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java new file mode 100644 index 00000000..8eec678f --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MClassOutline.java @@ -0,0 +1,27 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import java.util.List; + +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MClassOutline extends MChildOutline, MPackagedOutline, + MTargeted> { + + public MClassOutline getSuperClassOutline(); + + public List getPropertyOutlines(); + + public List getDeclaredPropertyOutlines(); + + public JDefinedClass getReferenceCode(); + + public JDefinedClass getImplementationCode(); + + public JClass getImplementationReferenceCode(); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java new file mode 100644 index 00000000..05761eae --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MElementOutline.java @@ -0,0 +1,14 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; + +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MElementOutline extends MChildOutline, MPackagedOutline, + MTargeted> { + + public JDefinedClass getCode(); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java new file mode 100644 index 00000000..b9ec0c16 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumConstantOutline.java @@ -0,0 +1,17 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; + +import com.sun.codemodel.JEnumConstant; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MEnumConstantOutline extends + MTargeted> { + + public MEnumOutline getEnumOutline(); + + public JEnumConstant getCode(); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java new file mode 100644 index 00000000..3e0dff63 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MEnumOutline.java @@ -0,0 +1,18 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import java.util.List; + +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; + +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MEnumOutline extends MChildOutline, MPackagedOutline, + MTargeted> { + + public List getEnumConstantOutlines(); + + public JDefinedClass getCode(); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java new file mode 100644 index 00000000..19cc24de --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MModelOutline.java @@ -0,0 +1,35 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import java.util.Collection; + +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; + +import com.sun.codemodel.JCodeModel; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MModelOutline extends MTargeted> { + + public Collection getPackageOutlines(); + + public MPackageOutline getPackageOutline(MPackageInfo target); + + public Collection getElementOutlines(); + + public MElementOutline getElementOutline(MElementInfo target); + + public Collection getClassOutlines(); + + public MClassOutline getClassOutline(MClassInfo target); + + public Collection getEnumOutlines(); + + public MEnumOutline getEnumOutline(MEnumLeafInfo target); + + public JCodeModel getCode(); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java new file mode 100644 index 00000000..3fe33a1b --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MObjectFactoryOutline.java @@ -0,0 +1,8 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import com.sun.codemodel.JDefinedClass; + +public interface MObjectFactoryOutline extends MChildOutline, MPackagedOutline { + + public JDefinedClass getCode(); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java new file mode 100644 index 00000000..dac3cb5f --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackageOutline.java @@ -0,0 +1,24 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import java.util.Collection; + +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; + +import com.sun.codemodel.JPackage; + +public interface MPackageOutline extends MChildOutline, MTargeted { + + public MPackageInfo getTarget(); + + public Collection getElementOutlines(); + + public Collection getClassOutlines(); + + public Collection getEnumOutlines(); + + public MObjectFactoryOutline getObjectFactoryOutline(); + + public JPackage getCode(); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java new file mode 100644 index 00000000..83c2ab96 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPackagedOutline.java @@ -0,0 +1,7 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +public interface MPackagedOutline { + + public MPackageOutline getPackageOutline(); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java new file mode 100644 index 00000000..f090d433 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessor.java @@ -0,0 +1,23 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; + +public interface MPropertyAccessor { + + public void get(JBlock block, JVar variable); + + public void set(JBlock block, String uniqueName, JExpression value); + + public void unset(JBlock body); + + public JExpression isSet(); + + public JType getType(); + + public boolean isConstant(); + + public boolean isVirtual(); +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java new file mode 100644 index 00000000..00586f7c --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyAccessorFactory.java @@ -0,0 +1,9 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import com.sun.codemodel.JExpression; + +public interface MPropertyAccessorFactory { + + public MPropertyAccessor createPropertyAccessor(JExpression target); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java new file mode 100644 index 00000000..144ca02d --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/MPropertyOutline.java @@ -0,0 +1,14 @@ +package org.jvnet.jaxb2_commons.xjc.outline; + +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MTargeted; + +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public interface MPropertyOutline extends + MTargeted>, MPropertyAccessorFactory { + + public MClassOutline getClassOutline(); + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java new file mode 100644 index 00000000..08e1f79e --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyAccessorFactory.java @@ -0,0 +1,5 @@ +package org.jvnet.jaxb2_commons.xjc.outline.artificial; + +public class AbstractPropertyAccessorFactory { + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java new file mode 100644 index 00000000..c5c970be --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractPropertyOutline.java @@ -0,0 +1,172 @@ +package org.jvnet.jaxb2_commons.xjc.outline.artificial; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.codemodel.JAnnotatable; +import com.sun.codemodel.JClass; +import com.sun.codemodel.JCodeModel; +import com.sun.codemodel.JDefinedClass; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JType; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public abstract class AbstractPropertyOutline implements MPropertyOutline { + + protected final Outline outline; + + protected final MModelOutline modelOutline; + + protected final MClassOutline classOutline; + + protected final MPropertyInfo propertyInfo; + + protected final JCodeModel codeModel; + + protected final JDefinedClass referenceClass; + + protected final JDefinedClass implementationClass; + + protected final JClass implementationReferenceClass; + + protected final JType type; + + public AbstractPropertyOutline(Outline outline, MClassOutline classOutline, + MPropertyInfo target) { + Validate.notNull(outline); + Validate.notNull(classOutline); + Validate.notNull(target); + this.outline = outline; + this.modelOutline = classOutline.getParent(); + this.classOutline = classOutline; + this.propertyInfo = target; + this.codeModel = classOutline.getParent().getCode(); + + this.referenceClass = classOutline.getReferenceCode(); + this.implementationClass = classOutline.getImplementationCode(); + this.implementationReferenceClass = classOutline + .getImplementationReferenceCode(); + + this.type = generateType(); + } + + protected JType generateType() { + return this.propertyInfo + .acceptPropertyInfoVisitor(new PropertyTypeVisitor( + this.modelOutline)); + } + + protected void annotate(JAnnotatable annotatable) { + this.propertyInfo + .acceptPropertyInfoVisitor(new AnnotatePropertyVisitor( + annotatable)); + } + + // protected JType getType(final Aspect aspect) { + // + // final List types = new ArrayList(); + // + // propertyInfo + // .acceptPropertyInfoVisitor(new DefaultPropertyInfoVisitor() { + // public Void visitAnyAttributePropertyInfo( + // MAnyAttributePropertyInfo info) { + // + // switch (aspect) { + // case EXPOSED: + // types.add(codeModel.ref(Map.class).narrow(QName.class) + // .narrow(Object.class)); + // break; + // + // default: + // types.add(codeModel.ref(Map.class).narrow(QName.class) + // .narrow(Object.class)); + // break; + // } + // + // return null; + // } + // + // @Override + // public Void visitAnyElementPropertyInfo( + // MAnyElementPropertyInfo info) { + // + // types + // // if + // // TODO Auto-generated method stub + // return super.visitAnyElementPropertyInfo(info); + // } + // }); + // + // final class TypeList extends ArrayList { + // private static final long serialVersionUID = 1L; + // + // void add(CTypeInfo t) { + // add(t.getType().toType(outline, Aspect.EXPOSED)); + // if (t instanceof CElementInfo) { + // // UGLY. element substitution is implemented in a way that + // // the derived elements are not assignable to base elements. + // // so when we compute the signature, we have to take derived + // // types + // // into account + // add(((CElementInfo) t).getSubstitutionMembers()); + // } + // } + // + // void add(Collection col) { + // for (CTypeInfo typeInfo : col) + // add(typeInfo); + // } + // } + // TypeList r = new TypeList(); + // r.add(prop.ref()); + // + // JType t; + // t = TypeUtil.getCommonBaseType(codeModel, r); + // + // // if item type is unboxable, convert t=Integer -> t=int + // // the in-memory data structure can't have primitives directly, + // // but this guarantees that items cannot legal hold null, + // // which helps us improve the boundary signature between our + // // data structure and user code + // if (prop.isUnboxable()) + // t = t.unboxify(); + // return t; + // } + + public MClassOutline getClassOutline() { + return classOutline; + } + + public MPropertyInfo getTarget() { + return propertyInfo; + } + + protected abstract class PropertyAccessor implements MPropertyAccessor { + + protected final JExpression target; + + public PropertyAccessor(JExpression target) { + Validate.notNull(target); + this.target = target; + } + + public JType getType() { + return AbstractPropertyOutline.this.type; + } + + public boolean isConstant() { + return false; + } + + public boolean isVirtual() { + return false; + } + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java new file mode 100644 index 00000000..3fbdbd0d --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AbstractSinglePropertyOutline.java @@ -0,0 +1,72 @@ +package org.jvnet.jaxb2_commons.xjc.outline.artificial; + +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JFieldVar; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public abstract class AbstractSinglePropertyOutline extends + AbstractPropertyOutline { + + protected final JFieldVar field; + + protected final JMethod getter; + + protected final JMethod setter; + + public AbstractSinglePropertyOutline(Outline outline, + MClassOutline classOutline, MPropertyInfo target) { + super(outline, classOutline, target); + this.field = generateField(); + this.getter = generateGetter(); + this.setter = generateSetter(); + } + + protected JFieldVar generateField() { + final JFieldVar field = referenceClass.field(JMod.PROTECTED, type, + propertyInfo.getPrivateName()); + annotate(field); + return field; + + } + + protected abstract JMethod generateGetter(); + + protected abstract JMethod generateSetter(); + + protected String getGetterMethodName() { + return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" + : "get") + propertyInfo.getPublicName(); + } + + protected String getSetterMethodName() { + return "set" + propertyInfo.getPublicName(); + } + + protected abstract class PropertyAccessor extends + AbstractPropertyOutline.PropertyAccessor { + + public PropertyAccessor(JExpression target) { + super(target); + } + + public void get(JBlock block, JVar variable) { + block.assign(variable, + target.invoke(AbstractSinglePropertyOutline.this.getter)); + } + + public void set(JBlock block, String uniqueName, JExpression value) { + block.invoke(target, AbstractSinglePropertyOutline.this.setter) + .arg(value); + } + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java new file mode 100644 index 00000000..b52af2b8 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnnotatePropertyVisitor.java @@ -0,0 +1,94 @@ +package org.jvnet.jaxb2_commons.xjc.outline.artificial; + +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; + +import com.sun.codemodel.JAnnotatable; +import com.sun.codemodel.JAnnotationUse; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class AnnotatePropertyVisitor implements + MPropertyInfoVisitor { + + private final JAnnotatable annotatable; + + public AnnotatePropertyVisitor(final JAnnotatable annotatable) { + Validate.notNull(annotatable); + this.annotatable = annotatable; + } + + public Void visitAnyAttributePropertyInfo( + MAnyAttributePropertyInfo info) { + this.annotatable.annotate(XmlAnyAttribute.class); + return null; + } + + public Void visitValuePropertyInfo(MValuePropertyInfo info) { + this.annotatable.annotate(XmlValue.class); + return null; + } + + public Void visitAttributePropertyInfo( + MAttributePropertyInfo info) { + + JAnnotationUse annotation = this.annotatable + .annotate(XmlAttribute.class); + + final String name = info.getAttributeName().getLocalPart(); + final String namespace = info.getAttributeName().getNamespaceURI(); + + annotation.param("name", name); + + // generate namespace property? + if (!namespace.equals("")) { // assume attributeFormDefault == + // unqualified + annotation.param("namespace", namespace); + } + + // TODO + // if(info.isRequired()) { + // xaw.required(true); + // } + + return null; + } + + public Void visitElementPropertyInfo( + MElementPropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public Void visitElementsPropertyInfo( + MElementsPropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public Void visitAnyElementPropertyInfo( + MAnyElementPropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public Void visitElementRefPropertyInfo( + MElementRefPropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public Void visitElementRefsPropertyInfo( + MElementRefsPropertyInfo info) { + throw new UnsupportedOperationException(); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java new file mode 100644 index 00000000..e6893f94 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/AnyAttributePropertyOutline.java @@ -0,0 +1,135 @@ +package org.jvnet.jaxb2_commons.xjc.outline.artificial; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.namespace.QName; + +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; + +import com.sun.codemodel.JAnnotatable; +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JFieldVar; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class AnyAttributePropertyOutline extends AbstractPropertyOutline { + + protected final JType type; + + protected final JFieldVar field; + + protected final JMethod getter; + + protected final JMethod setter; + + public AnyAttributePropertyOutline(Outline outline, + MClassOutline classOutline, + MAnyAttributePropertyInfo target) { + super(outline, classOutline, target); + + this.type = generateType(); + + this.field = generateField(); + + this.getter = generateGetter(); + + this.setter = generateSetter(); + + annotate(this.field); + + } + + protected JType generateType() { + return codeModel.ref(Map.class).narrow(QName.class) + .narrow(Object.class); + } + + protected JFieldVar generateField() { + final JFieldVar field = referenceClass.field( + JMod.PROTECTED, + type, + propertyInfo.getPrivateName(), + + JExpr._new(codeModel.ref(HashMap.class).narrow(QName.class) + .narrow(Object.class))); + return field; + } + + protected void annotate(JAnnotatable annotatable) { + annotatable.annotate(XmlAnyAttribute.class); + } + + protected JMethod generateGetter() { + final JMethod getter = referenceClass.method(JMod.PUBLIC, type, "get" + + propertyInfo.getPublicName()); + + getter.body()._return(JExpr._this().ref(this.field)); + return getter; + } + + protected JMethod generateSetter() { + JMethod setter = referenceClass.method(JMod.PUBLIC, codeModel.VOID, + "set" + propertyInfo.getPublicName()); + + JVar value = setter.param(type, "value"); + + setter.body().invoke(JExpr._this().ref(this.field), "clear"); + setter.body().invoke(JExpr._this().ref(this.field), "putAll") + .arg(value); + return setter; + } + + public MPropertyAccessor createPropertyAccessor(JExpression target) { + return new PropertyAccessor(target); + } + + public class PropertyAccessor extends + AbstractPropertyOutline.PropertyAccessor { + + public PropertyAccessor(JExpression target) { + super(target); + } + + public void get(JBlock block, JVar variable) { + target.invoke(AnyAttributePropertyOutline.this.getter); + + } + + public void set(JBlock block, String uniqueName, JExpression value) { + target.invoke(AnyAttributePropertyOutline.this.setter).arg(value); + } + + public void unset(JBlock body) { + target.invoke(AnyAttributePropertyOutline.this.getter).invoke( + "clear"); + } + + public JExpression isSet() { + return target.invoke(AnyAttributePropertyOutline.this.getter) + .invoke("isEmpty").not(); + } + + @Override + public JType getType() { + return AnyAttributePropertyOutline.this.type; + } + + @Override + public boolean isVirtual() { + return false; + } + + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java new file mode 100644 index 00000000..505c6e42 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/ConstantPropertyOutline.java @@ -0,0 +1,86 @@ +package org.jvnet.jaxb2_commons.xjc.outline.artificial; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JFieldVar; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public abstract class ConstantPropertyOutline extends AbstractPropertyOutline { + + protected final JExpression value; + + protected final JFieldVar field; + + public ConstantPropertyOutline(Outline outline, MClassOutline classOutline, + MPropertyInfo target, final JExpression value) { + super(outline, classOutline, target); + Validate.notNull(value); + this.value = value; + this.field = generateField(); + } + + protected JExpression createValue() { + return value; + } + + protected JFieldVar generateField() { + // generate the constant + JExpression value = createValue(); + + JFieldVar field = referenceClass.field(JMod.PUBLIC | JMod.STATIC + | JMod.FINAL, type, propertyInfo.getPublicName(), value); + + annotate(field); + + return field; + } + + public MPropertyAccessor createPropertyAccessor(JExpression target) { + return new PropertyAccessor(target); + } + + public class PropertyAccessor extends + AbstractPropertyOutline.PropertyAccessor { + + public PropertyAccessor(JExpression target) { + super(target); + } + + @Override + public boolean isConstant() { + return true; + } + + public void unset(JBlock body) { + } + + public void set(JBlock block, String uniqueName, JExpression value) { + } + + @Override + public boolean isVirtual() { + return false; + } + + public JExpression isSet() { + return JExpr.TRUE; + } + + public void get(JBlock block, JVar variable) { + block.assign(variable, ConstantPropertyOutline.this.referenceClass + .staticRef(ConstantPropertyOutline.this.field)); + } + + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java new file mode 100644 index 00000000..8dc193e8 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/PropertyTypeVisitor.java @@ -0,0 +1,74 @@ +package org.jvnet.jaxb2_commons.xjc.outline.artificial; + +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MAnyElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MAttributePropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementsPropertyInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; +import org.jvnet.jaxb2_commons.xml.bind.model.MValuePropertyInfo; + +import com.sun.codemodel.JType; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class PropertyTypeVisitor implements + MPropertyInfoVisitor { + + private final MModelOutline modelOutline; + + public PropertyTypeVisitor(MModelOutline modelOutline) { + Validate.notNull(modelOutline); + this.modelOutline = modelOutline; + } + + public JType visitAnyAttributePropertyInfo( + MAnyAttributePropertyInfo info) { + + return modelOutline.getCode().ref(Map.class).narrow(QName.class) + .narrow(Object.class); + } + + public JType visitElementPropertyInfo( + MElementPropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public JType visitElementsPropertyInfo( + MElementsPropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public JType visitAnyElementPropertyInfo( + MAnyElementPropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public JType visitAttributePropertyInfo( + MAttributePropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public JType visitValuePropertyInfo(MValuePropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public JType visitElementRefPropertyInfo( + MElementRefPropertyInfo info) { + throw new UnsupportedOperationException(); + } + + public JType visitElementRefsPropertyInfo( + MElementRefsPropertyInfo info) { + throw new UnsupportedOperationException(); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java new file mode 100644 index 00000000..d7502add --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/artificial/SinglePropertyOutline.java @@ -0,0 +1,58 @@ +package org.jvnet.jaxb2_commons.xjc.outline.artificial; + +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JMethod; +import com.sun.codemodel.JMod; +import com.sun.codemodel.JVar; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; +import com.sun.tools.xjc.outline.Outline; + +public class SinglePropertyOutline extends AbstractSinglePropertyOutline { + + public SinglePropertyOutline(Outline outline, MClassOutline classOutline, + MPropertyInfo target) { + super(outline, classOutline, target); + } + + protected JMethod generateGetter() { + final JMethod getter = referenceClass.method(JMod.PUBLIC, + type, getGetterMethodName()); + getter.body()._return(field); + return getter; + } + + protected JMethod generateSetter() { + final JMethod setter = referenceClass.method(JMod.PUBLIC, + codeModel.VOID, getSetterMethodName()); + final JVar value = setter.param(type, "value"); + setter.body().assign(JExpr._this().ref(field), value); + return setter; + } + + public MPropertyAccessor createPropertyAccessor(JExpression target) { + return new PropertyAccessor(target); + } + + protected class PropertyAccessor extends + AbstractSinglePropertyOutline.PropertyAccessor { + public PropertyAccessor(JExpression target) { + super(target); + } + + public JExpression isSet() { + return field.ne(JExpr._null()); + } + + public void unset(JBlock body) { + body.assign(field, JExpr._null()); + + } + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java new file mode 100644 index 00000000..931a1e8d --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMClassOutline.java @@ -0,0 +1,101 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; + +import com.sun.codemodel.JClass; +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class CMClassOutline implements MClassOutline { + + private final MModelOutline parent; + private final MPackageOutline packageOutline; + private final MClassInfo target; + private final MClassOutline superClassOutline; + + private final JDefinedClass referenceCode; + private final JDefinedClass implementationCode; + private final JClass implementationReferenceCode; + + private final List declaredPropertyOutlines = new ArrayList(); + private final List _delcaredPropertyOutlines = Collections + .unmodifiableList(declaredPropertyOutlines); + + public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline, + MClassInfo target, MClassOutline superClassOutline, + JDefinedClass referenceCode, JDefinedClass implementationCode, + JClass implementationReferenceCode) { + Validate.notNull(parent); + Validate.notNull(packageOutline); + Validate.notNull(target); + Validate.notNull(referenceCode); + Validate.notNull(implementationCode); + Validate.notNull(implementationReferenceCode); + this.parent = parent; + this.packageOutline = packageOutline; + this.target = target; + this.superClassOutline = superClassOutline; + this.referenceCode = referenceCode; + this.implementationCode = implementationCode; + this.implementationReferenceCode = implementationReferenceCode; + } + + public MModelOutline getParent() { + return parent; + } + + public MPackageOutline getPackageOutline() { + return packageOutline; + } + + public MClassInfo getTarget() { + return target; + } + + public MClassOutline getSuperClassOutline() { + return superClassOutline; + } + + public JDefinedClass getReferenceCode() { + return referenceCode; + } + + public JDefinedClass getImplementationCode() { + return implementationCode; + } + + public JClass getImplementationReferenceCode() { + return implementationReferenceCode; + } + + public List getPropertyOutlines() { + if (getSuperClassOutline() == null) { + return getDeclaredPropertyOutlines(); + } else { + final List propertyOutlines = new ArrayList(); + propertyOutlines.addAll(getSuperClassOutline() + .getPropertyOutlines()); + propertyOutlines.addAll(getDeclaredPropertyOutlines()); + return Collections.unmodifiableList(propertyOutlines); + } + } + + public List getDeclaredPropertyOutlines() { + return _delcaredPropertyOutlines; + } + + public void addDeclaredPropertyOutline(MPropertyOutline propertyOutline) { + this.declaredPropertyOutlines.add(propertyOutline); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java new file mode 100644 index 00000000..d11b4a14 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMElementOutline.java @@ -0,0 +1,48 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; + +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class CMElementOutline implements MElementOutline { + + private final MModelOutline parent; + private final MPackageOutline packageOutline; + private final MElementInfo target; + private final JDefinedClass code; + + public CMElementOutline(MModelOutline parent, + MPackageOutline packageOutline, MElementInfo target, + JDefinedClass code) { + Validate.notNull(parent); + Validate.notNull(packageOutline); + Validate.notNull(target); + Validate.notNull(code); + this.parent = parent; + this.packageOutline = packageOutline; + this.target = target; + this.code = code; + } + + public MModelOutline getParent() { + return parent; + } + + public MPackageOutline getPackageOutline() { + return packageOutline; + } + + public MElementInfo getTarget() { + return target; + } + + public JDefinedClass getCode() { + return code; + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java new file mode 100644 index 00000000..037ede4c --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumConstantOutline.java @@ -0,0 +1,42 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumConstantInfo; + +import com.sun.codemodel.JEnumConstant; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class CMEnumConstantOutline implements MEnumConstantOutline { + + private final MEnumOutline enumOutline; + + private final MEnumConstantInfo target; + + private final JEnumConstant code; + + public CMEnumConstantOutline(MEnumOutline enumOutline, + MEnumConstantInfo target, JEnumConstant code) { + Validate.notNull(enumOutline); + Validate.notNull(target); + Validate.notNull(code); + this.enumOutline = enumOutline; + this.target = target; + this.code = code; + } + + public MEnumOutline getEnumOutline() { + return enumOutline; + } + + public MEnumConstantInfo getTarget() { + return target; + } + + public JEnumConstant getCode() { + return code; + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java new file mode 100644 index 00000000..d7506c19 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMEnumOutline.java @@ -0,0 +1,67 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumConstantOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; + +import com.sun.codemodel.JDefinedClass; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class CMEnumOutline implements MEnumOutline { + + private final MModelOutline parent; + private final MPackageOutline packageOutline; + private final MEnumLeafInfo target; + private final JDefinedClass code; + + private final List enumConstantOutlines = new ArrayList(); + private final List _enumConstantOutlines = Collections + .unmodifiableList(enumConstantOutlines); + + public CMEnumOutline(MModelOutline parent, MPackageOutline packageOutline, + MEnumLeafInfo target, JDefinedClass code) { + Validate.notNull(parent); + Validate.notNull(packageOutline); + Validate.notNull(target); + Validate.notNull(code); + this.parent = parent; + this.packageOutline = packageOutline; + this.target = target; + this.code = code; + } + + public MModelOutline getParent() { + return parent; + } + + public MPackageOutline getPackageOutline() { + return packageOutline; + } + + public MEnumLeafInfo getTarget() { + return target; + } + + public JDefinedClass getCode() { + return code; + } + + public List getEnumConstantOutlines() { + return _enumConstantOutlines; + } + + public void addEnumConstantOutline(MEnumConstantOutline enumConstantOutline) { + Validate.notNull(enumConstantOutline); + Validate.isTrue(enumConstantOutline.getEnumOutline() == this); + this.enumConstantOutlines.add(enumConstantOutline); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java new file mode 100644 index 00000000..45b57606 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMModelOutline.java @@ -0,0 +1,119 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MElementInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MEnumLeafInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; + +import com.sun.codemodel.JCodeModel; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class CMModelOutline implements MModelOutline { + + private final MModelInfo target; + private final JCodeModel code; + + private final List packageOutlines = new ArrayList(); + private final List _packageOutlines = Collections + .unmodifiableList(packageOutlines); + private final Map packageOutlinesMap = new IdentityHashMap(); + private final List elementOutlines = new ArrayList(); + private final List _elementOutlines = Collections + .unmodifiableList(elementOutlines); + private final Map, MElementOutline> elementOutlinesMap = new IdentityHashMap, MElementOutline>(); + private final List classOutlines = new ArrayList(); + private final List _classOutlines = Collections + .unmodifiableList(classOutlines); + private final Map, MClassOutline> classOutlinesMap = new IdentityHashMap, MClassOutline>(); + private final List enumOutlines = new ArrayList(); + private final List _enumOutlines = Collections + .unmodifiableList(enumOutlines); + private final Map, MEnumOutline> enumOutlinesMap = new IdentityHashMap, MEnumOutline>(); + + public CMModelOutline(MModelInfo target, JCodeModel code) { + Validate.notNull(target); + Validate.notNull(code); + this.target = target; + this.code = code; + } + + public MModelInfo getTarget() { + return target; + } + + public JCodeModel getCode() { + return code; + } + + public Collection getPackageOutlines() { + return _packageOutlines; + } + + public MPackageOutline getPackageOutline(MPackageInfo target) { + return packageOutlinesMap.get(target); + } + + public void addPackageOutline(MPackageOutline packageOutline) { + Validate.notNull(packageOutline); + this.packageOutlines.add(packageOutline); + this.packageOutlinesMap.put(packageOutline.getTarget(), packageOutline); + } + + public Collection getClassOutlines() { + return _classOutlines; + } + + public MClassOutline getClassOutline(MClassInfo target) { + return classOutlinesMap.get(target); + } + + public void addClassOutline(MClassOutline classOutline) { + Validate.notNull(classOutline); + this.classOutlines.add(classOutline); + this.classOutlinesMap.put(classOutline.getTarget(), classOutline); + } + + public Collection getEnumOutlines() { + return _enumOutlines; + } + + public MEnumOutline getEnumOutline(MEnumLeafInfo target) { + return enumOutlinesMap.get(target); + } + + public void addEnumOutline(MEnumOutline enumOutline) { + Validate.notNull(enumOutline); + this.enumOutlines.add(enumOutline); + this.enumOutlinesMap.put(enumOutline.getTarget(), enumOutline); + } + + public Collection getElementOutlines() { + return _elementOutlines; + } + + public MElementOutline getElementOutline(MElementInfo target) { + return elementOutlinesMap.get(target); + } + + public void addElementOutline(MElementOutline elementOutline) { + Validate.notNull(elementOutline); + this.elementOutlines.add(elementOutline); + this.elementOutlinesMap.put(elementOutline.getTarget(), elementOutline); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java new file mode 100644 index 00000000..fec82a70 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMObjectFactoryOutline.java @@ -0,0 +1,40 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; + +import com.sun.codemodel.JDefinedClass; + +public class CMObjectFactoryOutline implements MObjectFactoryOutline { + + private final MModelOutline parent; + + private final MPackageOutline packageOutline; + + private final JDefinedClass code; + + public CMObjectFactoryOutline(MModelOutline parent, + MPackageOutline packageOutline, JDefinedClass code) { + Validate.notNull(parent); + Validate.notNull(packageOutline); + Validate.notNull(code); + this.parent = parent; + this.packageOutline = packageOutline; + this.code = code; + } + + public MModelOutline getParent() { + return parent; + } + + public MPackageOutline getPackageOutline() { + return packageOutline; + } + + public JDefinedClass getCode() { + return code; + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java new file mode 100644 index 00000000..ce8edc55 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPackageOutline.java @@ -0,0 +1,97 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MElementOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MEnumOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MModelOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MObjectFactoryOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPackageOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MPackageInfo; + +import com.sun.codemodel.JPackage; +import com.sun.tools.xjc.outline.PackageOutline; + +public class CMPackageOutline implements MPackageOutline { + + private final MModelOutline parent; + + private final MPackageInfo target; + + private final JPackage code; + + private final MObjectFactoryOutline objectFactoryOutline; + + private final List elementOutlines = new ArrayList(); + private final List classOutlines = new ArrayList(); + private final List enumOutlines = new ArrayList(); + + private final List _elementOutlines = Collections + .unmodifiableList(elementOutlines); + private final List _classOutlines = Collections + .unmodifiableList(classOutlines); + private final List _enumOutlines = Collections + .unmodifiableList(enumOutlines); + + public CMPackageOutline(MModelOutline parent, MPackageInfo target, + PackageOutline packageOutline) { + Validate.notNull(parent); + Validate.notNull(target); + this.parent = parent; + this.target = target; + this.code = packageOutline._package(); + this.objectFactoryOutline = new CMObjectFactoryOutline(parent, this, + packageOutline.objectFactory()); + } + + public MModelOutline getParent() { + return parent; + } + + public MPackageInfo getTarget() { + return target; + } + + public JPackage getCode() { + return code; + } + + public MObjectFactoryOutline getObjectFactoryOutline() { + return objectFactoryOutline; + } + + public Collection getClassOutlines() { + return _classOutlines; + } + + public void addClassOutline(MClassOutline classOutline) { + Validate.notNull(classOutline); + Validate.isTrue(classOutline.getPackageOutline() == this); + this.classOutlines.add(classOutline); + } + + public Collection getElementOutlines() { + return _elementOutlines; + } + + public void addElementOutline(MElementOutline elementOutline) { + Validate.notNull(elementOutline); + Validate.isTrue(elementOutline.getPackageOutline() == this); + this.elementOutlines.add(elementOutline); + } + + public Collection getEnumOutlines() { + return _enumOutlines; + } + + public void addEnumOutline(MEnumOutline enumOutline) { + Validate.notNull(enumOutline); + Validate.isTrue(enumOutline.getPackageOutline() == this); + this.enumOutlines.add(enumOutline); + } +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java new file mode 100644 index 00000000..66ea82ba --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessor.java @@ -0,0 +1,49 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; + +import com.sun.codemodel.JBlock; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JType; +import com.sun.codemodel.JVar; + +public class CMPropertyAccessor implements MPropertyAccessor { + + private final FieldAccessorEx fieldAccessor; + + public CMPropertyAccessor(FieldAccessorEx fieldAccessor) { + Validate.notNull(fieldAccessor); + this.fieldAccessor = fieldAccessor; + } + + public void get(JBlock block, JVar variable) { + fieldAccessor.toRawValue(block, variable); + } + + public void set(JBlock block, String uniqueName, JExpression value) { + fieldAccessor.fromRawValue(block, uniqueName, value); + } + + public void unset(JBlock body) { + fieldAccessor.unsetValues(body); + } + + public JExpression isSet() { + return fieldAccessor.hasSetValue(); + } + + public JType getType() { + return fieldAccessor.getType(); + } + + public boolean isConstant() { + return fieldAccessor.isConstant(); + } + + public boolean isVirtual() { + return fieldAccessor.isVirtual(); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java new file mode 100644 index 00000000..65208cf6 --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyAccessorFactory.java @@ -0,0 +1,31 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.util.FieldAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.FieldAccessorEx; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; + +import com.sun.codemodel.JExpression; +import com.sun.tools.xjc.outline.FieldOutline; + +public class CMPropertyAccessorFactory implements MPropertyAccessorFactory { + + private final FieldAccessorFactory fieldAccessorFactory; + private final FieldOutline fieldOutline; + + public CMPropertyAccessorFactory(FieldAccessorFactory fieldAccessorFactory, + FieldOutline fieldOutline) { + Validate.notNull(fieldAccessorFactory); + Validate.notNull(fieldOutline); + this.fieldAccessorFactory = fieldAccessorFactory; + this.fieldOutline = fieldOutline; + } + + public MPropertyAccessor createPropertyAccessor(JExpression target) { + FieldAccessorEx fieldAccessor = fieldAccessorFactory + .createFieldAccessor(fieldOutline, target); + return new CMPropertyAccessor(fieldAccessor); + } + +} diff --git a/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java new file mode 100644 index 00000000..4831106b --- /dev/null +++ b/tools/src/main/java/org/jvnet/jaxb2_commons/xjc/outline/concrete/CMPropertyOutline.java @@ -0,0 +1,45 @@ +package org.jvnet.jaxb2_commons.xjc.outline.concrete; + +import org.apache.commons.lang3.Validate; +import org.jvnet.jaxb2_commons.xjc.outline.MClassOutline; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessor; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyAccessorFactory; +import org.jvnet.jaxb2_commons.xjc.outline.MPropertyOutline; +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; + +import com.sun.codemodel.JExpression; +import com.sun.tools.xjc.model.nav.NClass; +import com.sun.tools.xjc.model.nav.NType; + +public class CMPropertyOutline implements MPropertyOutline { + + private final MClassOutline classOutline; + + private final MPropertyInfo target; + + private final MPropertyAccessorFactory propertyAccessorFactory; + + public CMPropertyOutline(MClassOutline classOutline, + MPropertyInfo target, + MPropertyAccessorFactory propertyAccessorFactory) { + Validate.notNull(classOutline); + Validate.notNull(target); + Validate.notNull(propertyAccessorFactory); + this.classOutline = classOutline; + this.target = target; + this.propertyAccessorFactory = propertyAccessorFactory; + } + + public MClassOutline getClassOutline() { + return classOutline; + } + + public MPropertyInfo getTarget() { + return target; + } + + public MPropertyAccessor createPropertyAccessor(JExpression target) { + return this.propertyAccessorFactory.createPropertyAccessor(target); + } + +}