├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── README_de.md ├── plugin ├── LICENSE ├── README.md ├── README_de.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── kscs │ │ │ └── util │ │ │ └── plugins │ │ │ └── xjc │ │ │ ├── BoundPropertiesPlugin.java │ │ │ ├── BuilderConfig.java │ │ │ ├── BuilderGenerator.java │ │ │ ├── BuilderGeneratorSettings.java │ │ │ ├── BuilderOutline.java │ │ │ ├── CopyGenerator.java │ │ │ ├── DeepClonePlugin.java │ │ │ ├── DeepCopyGenerator.java │ │ │ ├── DeepCopyPlugin.java │ │ │ ├── EpisodeBuilder.java │ │ │ ├── FluentBuilderPlugin.java │ │ │ ├── FullCopyGenerator.java │ │ │ ├── GroupInterfaceDirectStrategy.java │ │ │ ├── GroupInterfaceDummyStrategy.java │ │ │ ├── GroupInterfaceGenerator.java │ │ │ ├── GroupInterfaceGeneratorSettings.java │ │ │ ├── GroupInterfaceModelProcessingStrategy.java │ │ │ ├── GroupInterfacePlugin.java │ │ │ ├── ImmutablePlugin.java │ │ │ ├── InterfaceBinding.java │ │ │ ├── JavadocUtils.java │ │ │ ├── MetaPlugin.java │ │ │ ├── ModifierGenerator.java │ │ │ ├── ModifierPlugin.java │ │ │ ├── PartialCopyGenerator.java │ │ │ ├── PluginContext.java │ │ │ ├── PropertyTreeVarGenerator.java │ │ │ ├── ResettableStringReader.java │ │ │ ├── SchemaAnnotationUtils.java │ │ │ ├── SelectorGenerator.java │ │ │ ├── base │ │ │ └── PluginUtil.java │ │ │ ├── codemodel │ │ │ ├── ClassName.java │ │ │ ├── GenerifiedClass.java │ │ │ ├── JDirectInnerClassRef.java │ │ │ ├── JTypedInvocation.java │ │ │ └── NestedThisRef.java │ │ │ └── outline │ │ │ ├── DefinedClassOutline.java │ │ │ ├── DefinedInterfaceOutline.java │ │ │ ├── DefinedPropertyOutline.java │ │ │ ├── DefinedTypeOutline.java │ │ │ ├── InterfaceOutline.java │ │ │ ├── PropertyOutline.java │ │ │ ├── ReferencedInterfaceOutline.java │ │ │ ├── ReferencedPropertyOutline.java │ │ │ ├── ReferencedRuntimeClassOutline.java │ │ │ ├── ReferencedStubClassOutline.java │ │ │ └── TypeOutline.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.sun.tools.xjc.Plugin │ │ ├── com │ │ └── kscs │ │ │ └── util │ │ │ └── plugins │ │ │ └── xjc │ │ │ ├── BoundPropertiesPlugin.properties │ │ │ ├── BoundPropertiesPlugin_de.properties │ │ │ ├── BuilderGenerator.properties │ │ │ ├── BuilderGenerator_de.properties │ │ │ ├── DeepClonePlugin.properties │ │ │ ├── DeepClonePlugin_de.properties │ │ │ ├── DeepCopyGenerator.properties │ │ │ ├── DeepCopyGenerator_de.properties │ │ │ ├── DeepCopyPlugin.properties │ │ │ ├── DeepCopyPlugin_de.properties │ │ │ ├── FluentBuilderPlugin.properties │ │ │ ├── FluentBuilderPlugin │ │ │ └── doc.function.md │ │ │ ├── FluentBuilderPlugin_de.properties │ │ │ ├── GroupInterfaceDirectStrategy.properties │ │ │ ├── GroupInterfaceDirectStrategy_de.properties │ │ │ ├── GroupInterfaceDummyStrategy.properties │ │ │ ├── GroupInterfaceDummyStrategy_de.properties │ │ │ ├── GroupInterfaceGenerator.properties │ │ │ ├── GroupInterfaceGenerator_de.properties │ │ │ ├── GroupInterfacePlugin.properties │ │ │ ├── GroupInterfacePlugin │ │ │ ├── doc.function.md │ │ │ └── doc.motivation.md │ │ │ ├── GroupInterfacePlugin_de.properties │ │ │ ├── GroupInterfacePlugin_de │ │ │ ├── doc.function.md │ │ │ └── doc.motivation.md │ │ │ ├── ImmutablePlugin.properties │ │ │ ├── ImmutablePlugin_de.properties │ │ │ ├── MetaPlugin.properties │ │ │ ├── MetaPlugin │ │ │ └── doc.motivation.md │ │ │ ├── MetaPlugin_de.properties │ │ │ ├── MetaPlugin_de │ │ │ └── doc.motivation.md │ │ │ ├── ModifierPlugin.properties │ │ │ ├── ModifierPlugin │ │ │ ├── doc.function.md │ │ │ └── doc.motivation.md │ │ │ ├── ModifierPlugin_de.properties │ │ │ ├── ModifierPlugin_de │ │ │ ├── doc.function.md │ │ │ └── doc.motivation.md │ │ │ ├── PartialCopyGenerator.properties │ │ │ ├── PartialCopyGenerator_de.properties │ │ │ ├── base │ │ │ ├── PluginUtil.properties │ │ │ └── PluginUtil_de.properties │ │ │ └── interface-bindings.xsl │ │ ├── group-interfaces.xsd │ │ └── interfaces-episode.xsd │ ├── site │ ├── markdown │ │ ├── clone.md │ │ ├── clone_de.md │ │ ├── constrained-properties.md │ │ ├── constrained-properties_de.md │ │ ├── copy.md │ │ ├── copy_de.md │ │ ├── fluent-builder.md │ │ ├── fluent-builder_de.md │ │ ├── getting.md │ │ ├── group-contract.md │ │ ├── group-contract_de.md │ │ ├── history.md │ │ ├── immutable.md │ │ ├── immutable_de.md │ │ ├── index.md │ │ ├── meta.md │ │ ├── meta_de.md │ │ ├── modifier.md │ │ ├── modifier_de.md │ │ ├── usage.md │ │ └── usage_de.md │ ├── resources │ │ ├── images │ │ │ ├── bg_hr.png │ │ │ ├── blacktocat.png │ │ │ ├── icon_download.png │ │ │ └── sprite_download.png │ │ ├── javascripts │ │ │ └── main.js │ │ ├── params.json │ │ └── stylesheets │ │ │ ├── pygment_trac.css │ │ │ ├── stylesheet.css │ │ │ └── usage.css │ └── site.xml │ └── test │ ├── java │ └── com │ │ └── kscs │ │ └── util │ │ ├── jaxb │ │ ├── ChoiceTest.java │ │ └── ReservedWordTest.java │ │ ├── plugins │ │ └── xjc │ │ │ └── base │ │ │ └── PluginUsageBuilderTest.java │ │ └── test │ │ └── PluginRunTest.java │ └── resources │ ├── XInclude.xsd │ ├── XMLSchema.dtd │ ├── binding-config-custom-list.xjb │ ├── binding-config-default-value.xjb │ ├── binding-config-group-interface.xjb │ ├── binding-config-idrefs.xjb │ ├── binding-config-xhtml.xjb │ ├── binding-config.xjb │ ├── catalog.xml │ ├── custom-list-test.xsd │ ├── datatypes.dtd │ ├── default-value-test.xsd │ ├── group-interface-test.xsd │ ├── idrefs-test.xsd │ ├── jaxb2-plugin-test.xsd │ ├── math.xsd │ ├── netex.xsd │ ├── siri.xsd │ ├── svg.xsd │ ├── xhtml5.xsd │ └── xml-ns.xsd ├── pom.xml ├── runtime ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── kscs │ └── util │ └── jaxb │ ├── BoundList.java │ ├── BoundListProxy.java │ ├── Buildable.java │ ├── CollectionChangeEvent.java │ ├── CollectionChangeEventType.java │ ├── CollectionChangeListener.java │ ├── CollectionProperty.java │ ├── CollectionPropertyInfo.java │ ├── Copyable.java │ ├── IndirectCollectionProperty.java │ ├── IndirectCollectionPropertyInfo.java │ ├── IndirectPrimitiveCollectionProperty.java │ ├── IndirectPrimitiveCollectionPropertyInfo.java │ ├── ItemProperty.java │ ├── PartialCopyable.java │ ├── Property.java │ ├── PropertyInfo.java │ ├── PropertyTransformer.java │ ├── PropertyTree.java │ ├── PropertyTreeUse.java │ ├── PropertyVisitor.java │ ├── Selector.java │ ├── SingleProperty.java │ ├── SinglePropertyInfo.java │ ├── UnmodifiableCollection.java │ ├── UnmodifiableList.java │ ├── UnmodifiableListAdapter.java │ └── VetoableCollectionChangeListener.java ├── src └── site │ └── site.xml └── test ├── pom.xml └── src ├── main └── resources │ ├── XInclude.xsd │ ├── XMLSchema.dtd │ ├── binding-config.xjb │ ├── datatypes.dtd │ ├── jaxb2-plugin-test.xsd │ ├── math.xsd │ ├── svg.xsd │ ├── xhtml5.xsd │ ├── xlink.xsd │ └── xml-ns.xsd └── test ├── java └── com │ └── kscs │ ├── jaxb2 │ └── contract │ │ └── test │ │ └── TouristTest.java │ └── util │ └── jaxb │ ├── BeanAssert.java │ ├── BeanDiff.java │ ├── ChoiceTest.java │ ├── FluentBuilderPluginTest.java │ └── ReservedWordTest.java └── resources └── maven-4.0.0.xsd /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: mklemm 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | !.gitignore 3 | target/ 4 | _* 5 | .idea 6 | *.iml 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /plugin/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/BuilderConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc; 26 | 27 | /** 28 | * @author Mirko Klemm 2015-02-17 29 | */ 30 | public class BuilderConfig { 31 | } 32 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/BuilderOutline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.plugins.xjc; 25 | 26 | import com.kscs.util.plugins.xjc.outline.TypeOutline; 27 | import com.sun.codemodel.JClass; 28 | import com.sun.codemodel.JDefinedClass; 29 | 30 | /** 31 | * @author mirko 32 | * 25.03.14 33 | */ 34 | public class BuilderOutline { 35 | private final JClass builderClass; 36 | private final TypeOutline classOutline; 37 | 38 | BuilderOutline(final TypeOutline classOutline, final JClass builderClass) { 39 | this.classOutline = classOutline; 40 | this.builderClass = builderClass; 41 | } 42 | 43 | public JClass getBuilderClass() { 44 | return this.builderClass; 45 | } 46 | 47 | 48 | public JDefinedClass getDefinedBuilderClass() { 49 | return (JDefinedClass) this.builderClass; 50 | } 51 | 52 | 53 | public TypeOutline getClassOutline() { 54 | return this.classOutline; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/CopyGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc; 26 | 27 | import com.kscs.util.plugins.xjc.codemodel.JTypedInvocation; 28 | import com.sun.codemodel.JBlock; 29 | import com.sun.codemodel.JDocComment; 30 | import com.sun.codemodel.JVar; 31 | 32 | /** 33 | * @author Mirko Klemm 2015-03-17 34 | */ 35 | public interface CopyGenerator { 36 | void generatePartialArgs(JDocComment javadoc); 37 | 38 | PropertyTreeVarGenerator createPropertyTreeVarGenerator(final JBlock body, final String fieldName); 39 | 40 | JVar getPropertyTreeUseParam(); 41 | 42 | JVar getPropertyTreeParam(); 43 | 44 | JTypedInvocation generatePartialArgs(final JTypedInvocation invocation); 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/FullCopyGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc; 26 | 27 | import com.kscs.util.plugins.xjc.codemodel.JTypedInvocation; 28 | import com.sun.codemodel.JBlock; 29 | import com.sun.codemodel.JDocComment; 30 | import com.sun.codemodel.JExpression; 31 | import com.sun.codemodel.JVar; 32 | 33 | /** 34 | * @author Mirko Klemm 2015-03-17 35 | */ 36 | public class FullCopyGenerator implements CopyGenerator { 37 | @Override 38 | public void generatePartialArgs(final JDocComment javadoc) { 39 | } 40 | 41 | @Override 42 | public PropertyTreeVarGenerator createPropertyTreeVarGenerator(final JBlock body, final String fieldName) { 43 | return new TreeVarGenerator(); 44 | } 45 | 46 | @Override 47 | public JVar getPropertyTreeUseParam() { 48 | return null; 49 | } 50 | 51 | @Override 52 | public JVar getPropertyTreeParam() { 53 | return null; 54 | } 55 | 56 | @Override 57 | public JTypedInvocation generatePartialArgs(final JTypedInvocation invocation) { 58 | return invocation; 59 | } 60 | 61 | private static class TreeVarGenerator implements PropertyTreeVarGenerator { 62 | 63 | @Override 64 | public JVar getPropertyTreeVar() { 65 | return null; 66 | } 67 | 68 | @Override 69 | public JExpression generatePartialArgs(final JExpression invocation) { 70 | return invocation; 71 | } 72 | 73 | @Override 74 | public JBlock generateEnclosingBlock(final JBlock body) { 75 | return body; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/GroupInterfaceGeneratorSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc; 26 | 27 | import com.kscs.util.jaxb.bindings.Interface; 28 | 29 | /** 30 | * @author Mirko Klemm 2015-03-06 31 | */ 32 | public class GroupInterfaceGeneratorSettings extends Interface { 33 | private final BuilderGeneratorSettings builderGeneratorSettings; 34 | 35 | public GroupInterfaceGeneratorSettings(final boolean declareSetters, final boolean declareBuilderInterface, final String supportInterfaceNameSuffix, final BuilderGeneratorSettings builderGeneratorSettings) { 36 | this.builderGeneratorSettings = builderGeneratorSettings; 37 | setDeclareSetters(declareSetters); 38 | setDeclareBuilderInterface(declareBuilderInterface); 39 | setSupportInterfaceNameSuffix(supportInterfaceNameSuffix != null && supportInterfaceNameSuffix.isEmpty() ? null : supportInterfaceNameSuffix); 40 | } 41 | 42 | public boolean isGeneratingSupportInterface() { 43 | return this.supportInterfaceNameSuffix != null; 44 | } 45 | 46 | public BuilderGeneratorSettings getBuilderGeneratorSettings() { 47 | return this.builderGeneratorSettings; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/GroupInterfaceModelProcessingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * GNU General Public License 3 | * 4 | * Copyright (c) 2018 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | package com.kscs.util.plugins.xjc; 20 | 21 | import org.xml.sax.ErrorHandler; 22 | 23 | import com.sun.tools.xjc.BadCommandLineException; 24 | import com.sun.tools.xjc.Options; 25 | import com.sun.tools.xjc.model.Model; 26 | 27 | public interface GroupInterfaceModelProcessingStrategy { 28 | void onPluginActivation(final Options opts) throws BadCommandLineException; 29 | void onPostProcessModel(final Model model, ErrorHandler errorHandler); 30 | } 31 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/InterfaceBinding.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc; 26 | 27 | import com.sun.xml.txw2.TypedXmlWriter; 28 | import com.sun.xml.txw2.annotation.XmlAttribute; 29 | 30 | /** 31 | * @author Mirko Klemm 2015-02-11 32 | */ 33 | public interface InterfaceBinding extends TypedXmlWriter { 34 | @XmlAttribute 35 | void ref(String className); 36 | @XmlAttribute("declare-setters") 37 | void declareSetters(boolean declareSetters); 38 | @XmlAttribute("declare-builder-interface") 39 | void declareBuilderInterface(boolean declareBuilderInterface); 40 | } 41 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/ModifierPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc; 26 | 27 | import com.kscs.util.plugins.xjc.base.AbstractPlugin; 28 | import com.kscs.util.plugins.xjc.base.Opt; 29 | import com.kscs.util.plugins.xjc.outline.DefinedClassOutline; 30 | import com.sun.codemodel.JClassAlreadyExistsException; 31 | import com.sun.tools.xjc.Options; 32 | import com.sun.tools.xjc.outline.ClassOutline; 33 | import com.sun.tools.xjc.outline.Outline; 34 | import org.xml.sax.ErrorHandler; 35 | import org.xml.sax.SAXException; 36 | import org.xml.sax.SAXParseException; 37 | 38 | /** 39 | * @author Mirko Klemm 2015-03-14 40 | */ 41 | public class ModifierPlugin extends AbstractPlugin { 42 | 43 | @Opt 44 | protected String modifierClassName = "Modifier"; 45 | 46 | @Opt 47 | protected String modifierMethodName = "modifier"; 48 | 49 | @Override 50 | public String getOptionName() { 51 | return "Xmodifier"; 52 | } 53 | 54 | @Override 55 | public boolean run(final Outline outline, final Options opt, final ErrorHandler errorHandler) throws SAXException { 56 | final PluginContext pluginContext = PluginContext.get(outline, opt, errorHandler); 57 | for (final ClassOutline classOutline : outline.getClasses()) { 58 | try { 59 | final GroupInterfacePlugin groupInterfacePlugin = pluginContext.findPlugin(GroupInterfacePlugin.class); 60 | if (groupInterfacePlugin != null) { 61 | ModifierGenerator.generateClass(pluginContext, new DefinedClassOutline(classOutline), this.modifierClassName, this.modifierClassName, groupInterfacePlugin.getGroupInterfacesForClass(pluginContext, classOutline.implClass.fullName()), this.modifierMethodName); 62 | } else { 63 | ModifierGenerator.generateClass(pluginContext, new DefinedClassOutline(classOutline), this.modifierClassName, this.modifierMethodName); 64 | } 65 | } catch (final JClassAlreadyExistsException e) { 66 | errorHandler.error(new SAXParseException(e.getMessage(), classOutline.target.getLocator())); 67 | } 68 | } 69 | return true; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/PropertyTreeVarGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc; 26 | 27 | import com.sun.codemodel.JBlock; 28 | import com.sun.codemodel.JExpression; 29 | import com.sun.codemodel.JVar; 30 | 31 | /** 32 | * @author Mirko Klemm 2015-03-17 33 | */ 34 | public interface PropertyTreeVarGenerator { 35 | JVar getPropertyTreeVar(); 36 | 37 | JExpression generatePartialArgs(final JExpression invocation); 38 | 39 | JBlock generateEnclosingBlock(final JBlock body); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/ResettableStringReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc; 26 | 27 | import java.io.IOException; 28 | import java.io.Reader; 29 | import java.io.StringReader; 30 | 31 | /** 32 | * @author Mirko Klemm 2015-01-29 33 | */ 34 | class ResettableStringReader extends Reader { 35 | private StringReader stringReader; 36 | private final String s; 37 | 38 | public ResettableStringReader(final String s) { 39 | this.s = s; 40 | this.stringReader = new StringReader(s); 41 | } 42 | 43 | @Override 44 | public int read(final char[] cbuf, final int off, final int len) throws IOException { 45 | return this.stringReader.read(cbuf, off, len); 46 | } 47 | 48 | @Override 49 | public void close() throws IOException { 50 | this.stringReader.close(); 51 | this.stringReader = new StringReader(this.s); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/codemodel/ClassName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.codemodel; 26 | 27 | /** 28 | * @author Mirko Klemm 2015-03-12 29 | */ 30 | public class ClassName { 31 | private final String interfaceName; 32 | private final String className; 33 | 34 | public ClassName(final String interfaceName, final String className) { 35 | this.interfaceName = interfaceName; 36 | this.className = className; 37 | } 38 | 39 | public String getInterfaceName() { 40 | return this.interfaceName; 41 | } 42 | 43 | public String getClassName() { 44 | return this.className; 45 | } 46 | 47 | public String getName(final boolean isInterface) { 48 | return isInterface ? this.interfaceName : className; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/codemodel/GenerifiedClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.codemodel; 26 | 27 | import com.sun.codemodel.JClass; 28 | import com.sun.codemodel.JDefinedClass; 29 | import com.sun.codemodel.JTypeVar; 30 | 31 | /** 32 | * @author Mirko Klemm 2015-03-12 33 | */ 34 | public class GenerifiedClass { 35 | public final JDefinedClass raw; 36 | public final JTypeVar typeParam; 37 | public final JClass type; 38 | 39 | public GenerifiedClass(final JDefinedClass definedClass, final String typeParameterName) { 40 | this.raw = definedClass; 41 | this.typeParam = definedClass.generify(typeParameterName); 42 | this.type = definedClass.narrow(this.typeParam); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/codemodel/JDirectInnerClassRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.codemodel; 26 | 27 | import java.util.Collections; 28 | import java.util.Iterator; 29 | import java.util.List; 30 | import com.sun.codemodel.JClass; 31 | import com.sun.codemodel.JPackage; 32 | import com.sun.codemodel.JTypeVar; 33 | 34 | /** 35 | * @author Mirko Klemm 2015-03-06 36 | */ 37 | public class JDirectInnerClassRef extends JClass { 38 | private final boolean isInterface; 39 | private final boolean isAbstract; 40 | private final JClass superClass; 41 | private final JClass outer; 42 | private final String name; 43 | 44 | public JDirectInnerClassRef(final JClass outer, final String name, final boolean isInterface, final boolean isAbstract, final JClass superClass) { 45 | super(outer.owner()); 46 | this.outer = outer; 47 | this.name = name; 48 | this.isInterface = isInterface; 49 | this.isAbstract = isAbstract; 50 | this.superClass = superClass; 51 | } 52 | 53 | @Override 54 | public String fullName() { 55 | return this.outer.fullName() + "." + this.name; 56 | } 57 | 58 | @Override 59 | public String name() { 60 | return this.name; 61 | } 62 | 63 | @Override 64 | public JPackage _package() { 65 | return this.outer._package(); 66 | } 67 | 68 | @Override 69 | public JClass _extends() { 70 | return this.superClass; 71 | } 72 | 73 | @Override 74 | public Iterator _implements() { 75 | return Collections.emptyList().iterator(); 76 | } 77 | 78 | @Override 79 | public boolean isInterface() { 80 | return this.isInterface; 81 | } 82 | 83 | @Override 84 | public boolean isAbstract() { 85 | return this.isAbstract; 86 | } 87 | 88 | @Override 89 | protected JClass substituteParams(final JTypeVar[] variables, final List bindings) { 90 | return this; 91 | } 92 | 93 | @Override 94 | public JClass outer() { 95 | return this.outer; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/codemodel/NestedThisRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.codemodel; 26 | 27 | import com.sun.codemodel.JClass; 28 | import com.sun.codemodel.JExpressionImpl; 29 | import com.sun.codemodel.JFormatter; 30 | 31 | /** 32 | * @author Mirko Klemm 2015-03-12 33 | */ 34 | public class NestedThisRef extends JExpressionImpl { 35 | private final JClass jClass; 36 | 37 | public NestedThisRef(final JClass jClass) { 38 | this.jClass = jClass; 39 | } 40 | 41 | @Override 42 | public void generate(final JFormatter f) { 43 | f.g(jClass); 44 | f.p(".this"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/outline/DefinedTypeOutline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.outline; 26 | 27 | import java.util.List; 28 | import com.sun.codemodel.JDefinedClass; 29 | 30 | /** 31 | * @author Mirko Klemm 2015-03-12 32 | */ 33 | public interface DefinedTypeOutline extends TypeOutline { 34 | @Override 35 | JDefinedClass getImplClass(); 36 | 37 | @Override 38 | List getDeclaredFields(); 39 | } 40 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/outline/InterfaceOutline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.outline; 26 | 27 | import com.sun.codemodel.JClass; 28 | 29 | /** 30 | * @author Mirko Klemm 2015-03-05 31 | */ 32 | public interface InterfaceOutline extends TypeOutline { 33 | JClass getSupportInterface(); 34 | } 35 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/outline/PropertyOutline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.outline; 26 | 27 | import java.util.List; 28 | import java.util.Optional; 29 | 30 | import javax.xml.namespace.QName; 31 | 32 | import org.glassfish.jaxb.core.v2.model.core.TypeInfo; 33 | 34 | import com.sun.codemodel.JClass; 35 | import com.sun.codemodel.JDefinedClass; 36 | import com.sun.codemodel.JFieldVar; 37 | import com.sun.codemodel.JType; 38 | import com.sun.tools.xjc.model.nav.NClass; 39 | import com.sun.tools.xjc.model.nav.NType; 40 | 41 | /** 42 | * @author Mirko Klemm 2015-01-28 43 | */ 44 | public interface PropertyOutline { 45 | String getBaseName(); 46 | String getFieldName(); 47 | JType getRawType(); 48 | JType getElementType(); 49 | JFieldVar getFieldVar(); 50 | boolean hasGetter(); 51 | boolean isCollection(); 52 | boolean isIndirect(); 53 | List getChoiceProperties(); 54 | JClass getMutableListClass(); 55 | 56 | /** 57 | * @return The annotation description text from the corresponding part of the schema if there is any. 58 | */ 59 | default Optional getSchemaAnnotationText() { 60 | return Optional.empty(); 61 | } 62 | 63 | /** 64 | * @param tagRef The {@link TagRef} of the referenced type to get the schema annotation for 65 | * @return The annotation description text from the corresponding part of the schema if there is any. 66 | */ 67 | default Optional getSchemaAnnotationText(TagRef tagRef) { 68 | return Optional.empty(); 69 | } 70 | 71 | JDefinedClass getReferencedModelClass(); 72 | 73 | class TagRef { 74 | private final QName tagName; 75 | private final TypeInfo typeInfo; 76 | 77 | public TagRef(final QName tagName, final TypeInfo typeInfo) { 78 | this.tagName = tagName; 79 | this.typeInfo = typeInfo; 80 | } 81 | 82 | public QName getTagName() { 83 | return this.tagName; 84 | } 85 | 86 | public TypeInfo getTypeInfo() { 87 | return this.typeInfo; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/outline/ReferencedInterfaceOutline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.outline; 26 | 27 | import java.util.List; 28 | import com.sun.codemodel.JClass; 29 | 30 | /** 31 | * @author Mirko Klemm 2015-02-03 32 | */ 33 | public class ReferencedInterfaceOutline implements InterfaceOutline { 34 | private final JClass implClass; 35 | private final JClass supportInterface; 36 | 37 | public ReferencedInterfaceOutline(final JClass implClass, final String supportInterfaceNameSuffix) { 38 | this.implClass = implClass; 39 | this.supportInterface = supportInterfaceNameSuffix == null ? null : implClass.owner().ref(implClass._package().name() + "." + implClass.name() + supportInterfaceNameSuffix); 40 | } 41 | 42 | @Override 43 | public List getDeclaredFields() { 44 | return null; 45 | } 46 | 47 | @Override 48 | public TypeOutline getSuperClass() { 49 | return null; 50 | } 51 | 52 | @Override 53 | public JClass getImplClass() { 54 | return this.implClass; 55 | } 56 | 57 | @Override 58 | public boolean isLocal() { 59 | return false; 60 | } 61 | 62 | @Override 63 | public boolean isInterface() { 64 | return true; 65 | } 66 | 67 | @Override 68 | public JClass getSupportInterface() { 69 | return this.supportInterface; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/outline/ReferencedRuntimeClassOutline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.plugins.xjc.outline; 26 | 27 | import java.lang.reflect.Field; 28 | import java.util.ArrayList; 29 | import java.util.List; 30 | import com.sun.codemodel.JClass; 31 | import com.sun.codemodel.JCodeModel; 32 | 33 | /** 34 | * @author Mirko Klemm 2015-01-28 35 | */ 36 | public class ReferencedRuntimeClassOutline implements TypeOutline { 37 | private final Class referencedClass; 38 | private final JCodeModel codeModel; 39 | private final List declaredFields; 40 | 41 | private final ReferencedRuntimeClassOutline superClassOutline; 42 | 43 | public ReferencedRuntimeClassOutline(final JCodeModel codeModel, final Class referencedClass) { 44 | this.codeModel = codeModel; 45 | this.referencedClass = referencedClass; 46 | this.declaredFields = new ArrayList<>(referencedClass.getDeclaredFields().length); 47 | for (final Field field : referencedClass.getDeclaredFields()) { 48 | this.declaredFields.add(new ReferencedPropertyOutline(codeModel, field)); 49 | } 50 | this.superClassOutline = this.referencedClass.getSuperclass() != null && !Object.class.equals(this.referencedClass.getSuperclass()) 51 | ? new ReferencedRuntimeClassOutline(this.codeModel, this.referencedClass.getSuperclass()) 52 | : null; 53 | } 54 | 55 | @Override 56 | public List getDeclaredFields() { 57 | return this.declaredFields; 58 | } 59 | 60 | @Override 61 | public ReferencedRuntimeClassOutline getSuperClass() { 62 | return this.superClassOutline; 63 | } 64 | 65 | @Override 66 | public JClass getImplClass() { 67 | return this.codeModel.ref(this.referencedClass); 68 | } 69 | 70 | @Override 71 | public boolean isLocal() { 72 | return false; 73 | } 74 | 75 | @Override 76 | public boolean isInterface() { 77 | return false; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/outline/ReferencedStubClassOutline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * GNU General Public License 3 | * 4 | * Copyright (c) 2018 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | package com.kscs.util.plugins.xjc.outline; 20 | 21 | import java.util.List; 22 | 23 | import com.sun.codemodel.JClass; 24 | import com.sun.codemodel.JCodeModel; 25 | 26 | public class ReferencedStubClassOutline implements TypeOutline { 27 | private final JCodeModel codeModel; 28 | private final JClass clazz; 29 | private final TypeOutline superclass; 30 | 31 | public ReferencedStubClassOutline(final JCodeModel codeModel, final JClass clazz) { 32 | this.codeModel = codeModel; 33 | this.clazz = clazz; 34 | this.superclass = null; 35 | } 36 | 37 | @Override 38 | public List getDeclaredFields() { 39 | return List.of(); 40 | } 41 | 42 | @Override 43 | public TypeOutline getSuperClass() { 44 | return this.superclass; 45 | } 46 | 47 | @Override 48 | public JClass getImplClass() { 49 | return this.clazz; 50 | } 51 | 52 | @Override 53 | public boolean isLocal() { 54 | return false; 55 | } 56 | 57 | @Override 58 | public boolean isInterface() { 59 | return false; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/kscs/util/plugins/xjc/outline/TypeOutline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.plugins.xjc.outline; 25 | 26 | import com.sun.codemodel.JClass; 27 | 28 | import java.util.List; 29 | import java.util.Optional; 30 | 31 | /** 32 | * @author mirko 2014-05-29 33 | */ 34 | public interface TypeOutline { 35 | List getDeclaredFields(); 36 | TypeOutline getSuperClass(); 37 | JClass getImplClass(); 38 | boolean isLocal(); 39 | boolean isInterface(); 40 | 41 | /** 42 | * @return The annotation description text from the corresponding part of the schema if there is any. 43 | */ 44 | default Optional getSchemaAnnotationText() { 45 | return Optional.empty(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /plugin/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin: -------------------------------------------------------------------------------- 1 | com.kscs.util.plugins.xjc.BoundPropertiesPlugin 2 | com.kscs.util.plugins.xjc.DeepClonePlugin 3 | com.kscs.util.plugins.xjc.DeepCopyPlugin 4 | com.kscs.util.plugins.xjc.GroupInterfacePlugin 5 | com.kscs.util.plugins.xjc.ImmutablePlugin 6 | com.kscs.util.plugins.xjc.ModifierPlugin 7 | com.kscs.util.plugins.xjc.FluentBuilderPlugin 8 | com.kscs.util.plugins.xjc.MetaPlugin 9 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/BoundPropertiesPlugin.properties: -------------------------------------------------------------------------------- 1 | usage=Generate bound properties for JAXB serializable classes. 2 | usage.constrained=switch "constrained" property contract generation on/off. Default: yes 3 | usage.bound=switch "bound" property contract generation on/off. Default: yes 4 | usage.setterThrows=Declare setXXX methods to throw PropertyVetoException (yes), or rethrow as RuntimeException (no). Default: no 5 | usage.generateTools=Generate helper classes needed for collection change event detection. Turn off in modules that import other generated modules. Default: yes 6 | error.immutableAndConstrainedProperties="Immutable" plugin cannot be used together with "constrained-properties" plugin. An object can either be immutable, or it can send change notifications. 7 | doc.motivation=Many GUI applications use data binding to connect the data model to the view components. The JavaBeans standard defines a simple component model that also supports properties which send notifications whenever the are about to be changed, and there are even vetoable changes that allow a change listener to inhibit modification of a property. While the JAvaBeans standard is a bit dated, data binding and property change notification can come in handy in many situations, even for debugging or reverse-engineering existing code, because you can track any change made to the model instance. 8 | doc.function=constrained-properties generates additional code in the property setter methods of the POJOs generated by XJC that allow `PropertyChangeListener`s and `VetoableChangeListener`s to be attached to any instance of a XJC-generated class.\n\n\ 9 | Currently, **indexed properties** are NOT supported in the way specified by JavaBeans, but instead, if a property represents a collection, a collection proxy class is generated that supports its own set of collection-specific change notifications, vetoable and other. This decision has been made because by default XJC generates collection properties rather than indexed properties, and indexed properties as mandated by JavaBeans are generally considered "out of style". 10 | doc.limitations=* The JavaBeans standard is only loosely implemented in the generated classes.\n\ 11 | * Indexed Properties as defined in JavaBeans are not supported.\n\ 12 | * The CollectionChange behavior implemented by the classes is not yet documented and non-standard. 13 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/BoundPropertiesPlugin_de.properties: -------------------------------------------------------------------------------- 1 | usage=Erzeugt die Eigenschaften der generierten Klassen als "Bound Properties" oder "Constrained Properties" wie in der JavaBeans-Spezifikation vorgesehen. 2 | usage.constrained=Erzeuge "constrained properties", die durch das Werfen einer Exception eine \u00C4nderung ihres Zustandes unterbinden k\u00F6nnen. 3 | usage.bound=Erzeuge "bound properties", die die \u00C4nderung ihres Zustandes als Event weitermelden. 4 | usage.setterThrows=Wenn Constrained Properties verwendet werden, soll eine PropertyVetoException bei unerlaubter Zustands\u00E4nderung geworfen werden.\n\ 5 | Wenn dies auf "no" gesetzt ist, wird stattdessen eine "RuntimeException" erzeugt. 6 | usage.constrainedPropertiesGenerateTools=Die f\u00FCr die Verarbeitung von \u00C4nderungen an Collection-Eigenschaften notwendigen zus\u00E4tzlichen Klassen werden in den generierten Quelltext \ 7 | aufgenommen (y). Wird hier "no" angegeben, muss das JAR des XJC-Plugins in den Laufzeit-Klassenpfad der generierten Anwendung mit aufgenommen werden. 8 | usage.generateTools=Generiere die Hilfsklassen, die zur Realisierung der nicht-standardkonformen "Collection Changed" events gebraucht werden, als Quelltext. 9 | error.immutableAndConstrainedProperties=Das "Immutable"-Plugin kann nicht zusammen mit dem "Constrained-Properties" plugin verwendet werden. Ein Objekt ist entweder unver\u00E4nderlich, oder es kann \u00C4nderungsnachrichten senden. -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/DeepClonePlugin.properties: -------------------------------------------------------------------------------- 1 | usage=Generates Cloneable JAXB classes. 2 | usage.cloneThrows=Declare CloneNotSupportedException to be thrown by 'clone()' (yes), or suppress throws clause and wrap all `CloneNotSupportedException`s as `RuntimeException` (no).\n\ 3 | If you set this to `no`, the resulting code will violate the `java.lang.Cloneable` contract, since it is stated that an object that cannot be cloned should throw CloneNotSupportedException, and nothing else. \ 4 | This option has been added, however, to support legacy code that doesn't catch CloneNotSupportedExceptions. 5 | doc.motivation=Another way to create a deep copy of an object tree. This adheres to the `java.lang.Cloneable` contract, but isn't as versatile as `-Xcopy`. 6 | doc.function=The `clone` plugin generates a deep clone method for each of the generated classes, based on the following assumptions:\n\n\ 7 | * Objects implementing `java.lang.Cloneable` and are cloneable by their "clone" Method.\n\ 8 | * Objects not implementing `java.lang.Cloneable` or primitive types are assumed to be immutable, their references are copied over, they are not cloned. 9 | doc.bugs=The `-cloneThrows` option should in fact never have existed. 10 | doc.limitations=There is currently no way for the plugin to determine whether an object in the object graph that isn't cloneable actually is immutable so its reference can be copied. \ 11 | So, there is no guarantee that cloned object graphs are really independent of each other, as mandated by the `java.lang.Cloneable` contract. 12 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/DeepClonePlugin_de.properties: -------------------------------------------------------------------------------- 1 | usage=Generiert JAXB-Klassen, deren Instanzen mittels der 'clone'-Methode kopiert werden k\u00F6nnen. 2 | usage.cloneThrows='CloneNotSupportedException' in der Methodensignatur von 'clone()' deklarieren (yes), oder 'throws' weglassen und evtl. Exception intern ignorieren (no). 3 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/DeepCopyGenerator.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | defaultConstructor.javadoc.desc=Generated by copy-constructor plugin, JAXB requires public no-arg constructor. 26 | defaultConstructor.bodyComment=Generated by copy-constructor plugin, JAXB requires public no-arg constructor. 27 | copyConstructor.javadoc.desc=Instantiates a {0} copying the state of another {0} 28 | copyConstructor.javadoc.param.other=The original {0} from which to copy state. 29 | copyConstructor.javadoc.param.propertyPath=A restricting '{'@link PropertyPath'}' that defines which nodes of the source object tree should actually be copied. 30 | copyConstructor.javadoc.param.propertyPathUse=Meaning of the '{'@link PropertyPath'}': Exclude or include members contained in property path. 31 | copyConstructor.javadoc.exception=If parts or all of the source object tree cannot be copied. 32 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/DeepCopyGenerator_de.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | defaultConstructor.javadoc.desc=Generiert durch das copy-constructor Plugin. Wird von JAXB ben\u00F6tigt 26 | defaultConstructor.bodyComment=Keine Implementierung notwendig 27 | copyConstructor.javadoc.desc=Erzeugt eine "{0}"-Instanz als Kopie des Zustands einer anderen {0} 28 | copyConstructor.javadoc.param.other=Urspr\u00FCngliches "{0}"-Objekt von dem der Zustand kopiert wird. 29 | copyConstructor.javadoc.param.propertyPath='{'@link PropertyPath'}' durch den definiert wird, welche Teile des Quell-Objektbaumes tats\u00E4chlich kopiert werden. 30 | copyConstructor.javadoc.param.propertyPathUse=Bedeutung des '{'@link PropertyPath'}': Einschlie\u00DFend (INCLUDE) oder ausschlie\u00DFend (EXCLUDE). 31 | copyConstructor.javadoc.exception=Wenn Teile des Quell-Objektbaumes nicht kopiert werden k\u00F6nnen. 32 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/DeepCopyPlugin_de.properties: -------------------------------------------------------------------------------- 1 | usage=Generiert JAXB-Klassen, deren Instanzen mittels einer "createCopy"-Methode oder eines Copy-Konstruktors kopiert werden k\u00F6nnen. 2 | usage.generateTools=Generiere Hilfsklassen als Quelltext (y). Wenn dies ausgeschaltet ist, muss sich das Plugin-JAR zur Laufzeit im Klassenpfad \ 3 | der generierten Klassendefinitionen befinden. 4 | usage.constructor=Erzeugt einen Copy-Konstruktor f\u00FCr jede generierte Klasse des XSD-Modells. 5 | usage.narrow=F\u00FCr untergeordnete Knoten im zu kopierenden Objektbaum werden ebenfalls die Copy-Konstruktoren der deklarierten Typen verwendet, \ 6 | soweit diese vorhanden sind und die Typen der entsprechenden Instanzen ebenfalls aus dem XSD-Model generierte Klassen sind. Dies erzeugt eine m\u00F6glichst \ 7 | "schmale" Kopie des Ausgangsobjekts, was in bestimmten F\u00E4llen n\u00FCtzlich sein kann. Ein Unterknoten, dessen Typ nicht im aktuellen XSD-Modell deklariert ist, \ 8 | wird immer wie bei der 'createCopy()'-Methode kopiert. Ist diese Option "no", gilt dies auch f\u00FCr generierte Typen. 9 | usage.partial=Generiert zus\u00E4tzlich eine 'createCopy()'-Methode und einen Konstruktor (wenn "-constructor=yes"), \ 10 | mit dem sich Objekte partiell kopieren lassen. Dabei wird ein PropertyPath-Objekt mitgegeben, welches die zu kopierenden Knoten des Objektbaumes angibt. 11 | usage.selectorClassName=Name der generierten inneren "Selector" Builder-Klasse, die intern zum Aufbau des Property-Baums f\u00FCr das partielle Kopieren benutzt wird. \ 12 | Diese Einstellung gilt auch f\u00FCr das "Fluent Builder"-Plugin, wenn dieses zus\u00E4tzlich aktiv ist und dort "copy-partial=y" eingestellt ist. 13 | usage.rootSelectorClassName=Name der generierten inneren "Select" -Klasse, die vom aufrufenden Code als Einstieg in den Aufbau eines Property-Baumes f\u00FCr das partielle Kopieren verwendet werden kann. \ 14 | Diese Einstellung gilt auch f\u00FCr das "Fluent Builder"-Plugin, wenn dieses zus\u00E4tzlich aktiv ist und dort "-copy-partial=y" eingestellt ist. 15 | 16 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfaceDirectStrategy.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | error.xml-schema-required=Group interface generation only works with XML Schema as model language. 26 | 27 | 28 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfaceDirectStrategy_de.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | error.xml-schema-required=Die Generierung von Java Interfaces aus und Schema-Elementen funktioniert nur, wenn das Eingabemodell ein XML-Schema (XSD) ist. 26 | 27 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfaceDummyStrategy.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | error.plugin-setup=Error in pre-generator stage of the group-contract-plugin: {0} 26 | 27 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfaceDummyStrategy_de.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | error.plugin-setup=Fehler in der Generator-Vorstufe des group-interface-plugins: {0} 26 | 27 | 28 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfaceGenerator.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | error.interface-exists=Interface {0}\#{1} already exists. Skipping builder interface generation. 26 | error.package-not-found=No package found for namespace {0} 27 | error.interface-not-found=No interface found for model group {0} converted name was {1} 28 | error.no-implementation=Interface {0}, defined by group declaration '{'{1}'}'{2} has no implementation. 29 | comment.generated-from-xs-decl.header=Interface generated from group/attributeGroup declaration: 30 | comment.generated-from-xs-decl.qname='{'{0}'}'{1} 31 | comment.generated-from-xs-decl.locator=Schema document "{0}", line {1}, column {2} 32 | comment.generated-from-xs-decl.source=The following schema fragment is represented by this interface: 33 | error.property-not-found=Property "{0}" declared by schema component "{1}" not found in interface "{2}" 34 | 35 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfaceGenerator_de.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | error.interface-exists=Interface {0}\#{1} ist bereits vorhanden. Builder interface-Generierung wird ausgelassen. 26 | error.package-not-found=Kein Java-Package f\u00FCr XML-Namensraum {0} gefunden. 27 | error.interface-not-found=Kein Interface f\u00FCr die oder "{0}" gefunden. Java Name: {1} 28 | error.no-implementation=Interface {0}, definiert durch Gruppe '{'{1}'}'{2} hat keine Implementierung. 29 | comment.generated-from-xs-decl.header=Interface-Deklaration generiert aus der group/attributeGroup-Deklaration: 30 | comment.generated-from-xs-decl.qname='{'{0}'}'{1} 31 | comment.generated-from-xs-decl.locator=Schema-Dokument "{0}", Zeile {1}, Position {2} 32 | comment.generated-from-xs-decl.source=Folgendes Schema-Fragment wird durch dieses Interface repr\u00E4sentiert: 33 | error.property-not-found=Property "{0}" definiert durch Schema-Komponente "{1}" im Interface "{2}" nicht gefunden 34 | 35 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfacePlugin.properties: -------------------------------------------------------------------------------- 1 | usage=Transforms and XSD definitions to java interface declarations, and makes complexTypes using \ 2 | the group implement this interface. 3 | usage.declareSetters=Also generate property setter methods in interface declarations. 4 | usage.declareBuilderInterface=If the "fluent builder plugin" (-Xfluent-builder) is also active, generate interface for the internal builder classes as well. 5 | usage.upstreamEpisodeFile=Use the given resource file to obtain information about interfaces defined in an upstream module (refer to "-episode" option of XJC). 6 | usage.downstreamEpisodeFile=Generate "episode" file for downstream modules in the given resource location. 7 | usage.supportInterfaceNameSuffix=If this is set, methods that could cause type conflicts when two generated interfaces are used together as type parameter bounds, will be put in another interface named the same as the original interface, but with the suffix specified here. 8 | error.plugin-setup=Error setting up group-interface-plugin {0} 9 | error.cannot-instantiate-strategy=Exception while instantiating preprocessing strategy: {0}. 10 | error.no-such-constructor=Strategy class {0} has no default constructor. 11 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfacePlugin/doc.motivation.md: -------------------------------------------------------------------------------- 1 | In most object-oriented programming languages, there are constructs to define a "contract", that concrete implementations of complex 2 | types will implement. In Java, for example, there is the `interface`, in Scala there are "traits", and so on. 3 | The XML Schema Definition Language (XSD) in contrast, has no explicit construct to ensure a complex type meets a 4 | pre-defined contract. There are, however, the `group` and `attributeGroup` elements, that could be considered 5 | a way to achieve just that: A complexType that uses a `` or an `` will expose the 6 | properties defined in these group definitions. Looking at it that way, you could say that the `complexType` 7 | "implements" the contract defined by the `group` or `attributeGroup`. 8 | 9 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfacePlugin_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mklemm/jaxb-rich-contract-plugin/a0df93a4cc0f3111ace568431dbb9bf7bdee7704/plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfacePlugin_de.properties -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfacePlugin_de/doc.function.md: -------------------------------------------------------------------------------- 1 | The group-contract plugin now tries to model that case in the generated source code. For every `group`and `attributeGroup` 2 | definition in the XSD model (or in any upstream XSD model that is included via the "episode" mechanism, for that matter), 3 | it generates an `interface` definition with all the getter, and optionally setter, methods of the properties defined via 4 | the `group` or `attributeGroup` definition. 5 | 6 | Then, it declares every class that was generated from a `complexType` that uses the `group` or `attributeGroup` as implementing 7 | just that interface. This way, all classes generated from XSD complexTypes that use the same group definitions, will 8 | share a common contract and can be treated in a common way by client code. 9 | 10 | If the "fluent-builder" plugin is also activated, the interface definition can optionally include the declarations of the "with..." 11 | and "add..." methods of the generated builder class as a nested interface declaration, so you can even rely on a common 12 | "builder" contract for classes using the same `group` and `attributeGroup` definitions. 13 | 14 | For example, you may wish to add "XLink" functionality to your generated classes. If the group-contract plugin is 15 | activated, you can define a complexType in XSD that supports the "simple" attributes by adding to its XSD definition: 16 | 17 | ``` xml 18 | 19 | .... (model group of the type...) 20 | 21 | 22 | ``` 23 | 24 | Which will generate a class something like: 25 | 26 | ``` java 27 | public class SomeType implements SimpleAttrs { 28 | ... 29 | ``` 30 | 31 | And an interface definition like: 32 | 33 | ``` java 34 | public interface SimpleAttrs { 35 | String getHref(); 36 | void setHref(final String value); 37 | // ... more properties ... 38 | 39 | // this part is generated only if fluent-builder is also active 40 | interface BuildSupport{ 41 | public SimpleAttrs.BuildSupport withHref(final String href); 42 | //... more properties ... 43 | } 44 | } 45 | ``` 46 | 47 | Similar effects could be achieved by subclassing complexTypes, but since there is no multiple inheritance, inheritance 48 | hierarchies can get overly complex this way, and inheritance is less flexible than interface implementations. 49 | 50 | **Note:** The group-contract plugin supports JAXB modular compilation, i.e. the "episode" mechanism implemented 51 | in the JAXB reference impplementation. 52 | However, due to the lack of extensibility of the current default episode data structures and processing, this plugin 53 | has to manage its own "episode" file. There are two command line options to control the names of the "upstream" episode 54 | file, i.e. the file name the plugin should look for when using other modules, and the "downstream" file, i.e. the file 55 | name that should be generated for use by other modules. 56 | 57 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/GroupInterfacePlugin_de/doc.motivation.md: -------------------------------------------------------------------------------- 1 | In most object-oriented programming languages, there are constructs to define a "contract", that concrete implementations of complex 2 | types will implement. In Java, for example, there is the `interface`, in Scala there are "traits", and so on. 3 | The XML Schema Definition Language (XSD) in contrast, has no explicit construct to ensure a complex type meets a 4 | pre-defined contract. There are, however, the `group` and `attributeGroup` elements, that could be considered 5 | a way to achieve just that: A complexType that uses a `` or an `` will expose the 6 | properties defined in these group definitions. Looking at it that way, you could say that the `complexType` 7 | "implements" the contract defined by the `group` or `attributeGroup`. 8 | 9 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/ImmutablePlugin.properties: -------------------------------------------------------------------------------- 1 | usage=Makes XJC generate immutable classes. "set"-methods are being transformed to "protected" access, collections are exposed as "collections.unmodifiableCollection". 2 | usage.constructorAccess=Generate constructors of an immutable class with the specified access level ("public", "private", \ 3 | "protected", "default"). By specification, JAXB needs a public no-arg constructor for marshalling and unmarshalling objects \ 4 | to an from XML. It turns out, however, that many implementations support protected constructors as well.\n\ 5 | This option has been included since it doesn't make sense to construct an empty object which then cannot be modified, \ 6 | But anyway, use with caution. 7 | usage.generateModifier=Generate an inner class that allows write access to the properties of the otherwise immutable instance. This can be useful if objects have to be mutable in some special scenarios, but this fact should be controlled. 8 | usage.modifierClassName=Name of the generated inner class that allows to modify the state of generated objects (if generateModifier=y). 9 | usage.modifierMethodName=Name of the generated method that allows to instantiate the modifier class (if generateModifier=y). 10 | usage.fake=Do not actually make anything immutable. For test and debug purpose only. 11 | usage.overrideCollectionClass=Modify collection getters to be declared to return a custom type implementing java.lang.Iterable instead of List. 12 | error.immutableAndConstrainedProperties="Immutable" plugin cannot be used together with "constrained-properties" plugin. An object can either be immutable, or it can send change notifications. 13 | doc.motivation=Generally it is advisable to make your business classes immutable as much as possible, to minimise side effects and allow for functional programming patterns. 14 | doc.function=This plugin simply makes all "setXXX" methods "protected", thus preventing API consumers to modify state of instances of generated classes after they have been created. This only makes sense together with another plugin that allows for initialization of the instances, like e.g. the included `fluent-builder` plugin. For collection-valued properties, `-Ximmutable` wraps all collections in a `Collections.unmodifiableCollection`, so collections are also made immutable. Because JAXB serialization has a number of constraints regarding the internals of JAXB serializable objects, it wasn't advisable to just remove the setter methods or replace the collections with unmodifiable collections. So, a bit of additional code will be created that leaves the old "mutable" structure of the class intact as much as is needed for JAXB, but modifies the public interface so objects appear immutable to client code. 15 | doc.limitations=* Access level "protected" may not be strict enough to prevent state changes.\n\ 16 | * If you activate plugins like "fluent-api" or the like, these plugins may circumvent the protection provided by the `immutable` plugin. 17 | comment.constructor=Generated by \"immutable\" plugin to prevent creation of immutable empty instances. 18 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/ImmutablePlugin_de.properties: -------------------------------------------------------------------------------- 1 | usage=Veranlasst XJC dazu, die generierten Klassen unver\u00E4nderlich zu machen.\nAlle set-Methoden werden protected gemacht, collections werden als "Collections.unmodifiableCollection" erzeugt. 2 | usage.constructorAccess=Setzt die Sichtbarkeit des von JAXB geforderten argumentlosen Konstruktors auf den angegebenen Wert \ 3 | ("public", "private", "protected", "default"). Die JAXB-Spezifikation fordert eigentlich, dass der Konstruktor "public" sein \ 4 | soll, aber in vielen Implementierungen funktioniert auch "protected". Diese Option wurde eingef\u00FChrt, da es normalerweise \ 5 | wenig sinnvoll ist, ein leeres Objekt zu erzeugen, das danach nicht mehr \ 6 | ver\u00E4ndert werden kann. Dennoch ist dies nicht standardkonform und daher mit Vorsicht zu benutzen. 7 | usage.generateModifier=Eine innere Klasse erzeugen, die dennoch eine Zustands\u00E4nderung des darunterliegenden Objekts erlaubt. 8 | usage.modifierClassName=Name der generierten Mutator-Klasse (wenn generateModifier=y) 9 | usage.modifierMethodName=Name der generierten methode zum Abruf einer Instanz der Mutator-Klasse (wenn generateModifier=y) 10 | usage.fake=Nur f\u00FCr Test und Debug: Es wird nichts wirklich unver\u00E4nderlich gemacht, aber das Plugin bleibt aktiv. 11 | usage.collectionsAsIterable=Mehrwertige Eigenschaften werden als der angegebene Typ, der java.util.Iterable implementiert, deklariert, anstelle von List, um deklarative Unver\u00E4nderlichkeit sicherzustellen. 12 | error.immutableAndConstrainedProperties=Das "Immutable"-Plugin kann nicht zusammen mit dem "Constrained-Properties" plugin verwendet werden. Ein Objekt ist entweder unver\u00E4nderlich, oder es kann \u00C4nderungsnachrichten senden. 13 | comment.constructor=Generiert durch das "Immutable"-Plugin, um das Erzeugen leerer unver\u00E4nderlicher Objekte zu unterbinden. 14 | 15 | 16 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/MetaPlugin.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | usage=XJC plugin to generate meta data for generated JAXB classes. Generates an inner class with static field \ 25 | containing information about each of the defined properties. 26 | usage.camelCase=Generate names of constant meta fields like field names, instead of Java constant name convention. 27 | usage.metaClassName=Name of the generated meta-information nested class. 28 | usage.extended=Generate extended meta data for each property: Name, type, multiplicity, default value. 29 | usage.generateTools=Generate helper class used to represent extended metadata as source code.\n\ 30 | If this is set to "n" and "-extended=y", the plugin JAR will have to be in the runtime classpath of the client application. 31 | usage.allowSet=Allow property values to be set via property meta information. 32 | usage.visitMethodName=Name of the method to apply a visitor. 33 | error.metaClassExists=Cannot generate meta data inner class "{0}.{1}" there is already a class with the same name. 34 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/MetaPlugin/doc.motivation.md: -------------------------------------------------------------------------------- 1 | Sometimes, you need information about the properties of a class, or you wish to have a constant for the names of properties. 2 | The "meta" plugin creates an inner class (the name of which can be controlled by a command-line option), and adds a constant 3 | field for each property. If the `-extended=y` command-line option is specified, these constants will hold instances of the 4 | `PropertyInfo` class, on which the name, type, multiplicity (collection or not) and default value (from XSD) are exposed. 5 | Without `-extended`, the constants are simply string constants holding the property names. 6 | 7 | As a new feature in version 1.10, a visitor pattern has been added that allows to visit all properties of 8 | an object graph. 9 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/MetaPlugin_de.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | usage=XJC-Plugin zum Erzeugen von Metadaten f\u00FCr eine JAXB-Klasse. Generiert eine innere Klasse mit statischen \ 25 | Feldern, die jeweils Informationen \u00FCber die einzelnen Eigenschaften enthalten. 26 | usage.camelCase=Namen der Konstanten wie Feldnamen generieren, nicht nach Java-Konstanten-Konvention. 27 | usage.metaClassName=Name der generierten inneren Metainfoklasse. 28 | usage.extended=Generiere erweiterte Metadaten f\u00FCr jedes Property: Name, Typ, Multiplizit\u00E4t, Standardwert 29 | usage.generateTools=Generiere die Hilfsklasse zur Darstellung der erweiterten Metadaten als Quelltext.\n\ 30 | Wenn hier "n" angegeben wird und "extended=y", so muss das plugin JAR zur Laufzeit im Klassenpfad der client-Anwendung sein. 31 | usage.allowSet=Generiere eine M\u00F6glichkeit, den Wert eines Propertys \u00FCber die Metadaten zu \u00E4ndern. 32 | usage.visitMethodName=Name der Methode, mit der ein Visitor durch das Objekt geschickt werden kann. 33 | error.metaClassExists=Innere Klasse "{0}.{1}" kann nicht generiert werden, da schon eine gleichnamige Klasse existiert. 34 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/MetaPlugin_de/doc.motivation.md: -------------------------------------------------------------------------------- 1 | Sometimes, you need information about the properties of a class, or you wish to have a constant for the names of properties. 2 | The "meta" plugin creates an inner class (the name of which can be controlled by a command-line option), and adds a constant 3 | field for each property. If the `-extended=y` command-line option is specified, these constants will hold instances of the 4 | `PropertyInfo` class, on which the name, type, multiplicity (collection or not) and default value (from XSD) are exposed. 5 | Without `-extended`, the constants are simply string constants holding the property names. 6 | 7 | In Version 1.10 wurde neu ein "Visitor"-Muster eingeführt, über das sich der gesamte Objektgraph durchlaufen lässt. 8 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/ModifierPlugin.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | usage=Generates an inner class that allows write access to an object's state, even if write access is prohibited by the "immutable" plugin. This can be useful if objects have to be mutable in some special scenarios, but this fact should be controlled. 26 | usage.modifierClassName=Name of the generated inner class that allows to modify the state of generated objects. 27 | usage.modifierMethodName=Name of the generated method that allows to instantiate the modifier class. 28 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/ModifierPlugin/doc.function.md: -------------------------------------------------------------------------------- 1 | This plugin creates an inner class with public setXXX methods, and getXXX methods for collection properties that 2 | return a writable version of the collection the property is implemented by. 3 | 4 | If the `group-contract` plugin is also activated, these constructs will also be generated into the interfaces. 5 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/ModifierPlugin/doc.motivation.md: -------------------------------------------------------------------------------- 1 | In general, you may wish to implement application logic in a way so that objects are initialized once 2 | and then are immutable. 3 | For traditional programming languages, like Java, for example, this is not always feasible in practice, 4 | because legacy code and libraries have to be used. 5 | 6 | With the `modifier` plugin, you can make the public interface of your classes immutable via the `immutable` 7 | plugin, but at the same time provide a handle to modify the state of your objects anyway vi a reference that 8 | needs to be queried explicitly. 9 | 10 | This plugin is intended for use while refactoring existing code to a more "functional" and thread-friendly 11 | code base. Eventually, your code should work so this plugin can be deactivated in your XJC configuration. -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/ModifierPlugin_de.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | usage=Erzeugt eine innere Klasse, die (z.B. trotz "immutable"-Plugin) eine Zustands\u00E4nderung des darunterliegenden Objekts erlaubt. 26 | usage.modifierClassName=Name der generierten Mutator-Klasse 27 | usage.modifierMethodName=Name der generierten methode zum Abruf einer Instanz der Mutator-Klasse 28 | 29 | 30 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/ModifierPlugin_de/doc.function.md: -------------------------------------------------------------------------------- 1 | Es wird eine innere Klasse generiert, die öffentliche setXXX-Methoden und getXXX-Methoden für Collections enthält, wobei 2 | schreibbare Collection-Instanzen zurückgegeben werden. 3 | 4 | Wenn das `group-contract`-Plugin ebenfalls aktiviert ist, werden diese Konstrukte auch in den Interfaces erzeugt. -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/ModifierPlugin_de/doc.motivation.md: -------------------------------------------------------------------------------- 1 | Generell ist es vorteilhaft, Anwendungslogik so zu implementieren, dass Objekte in der Regel nach der 2 | Initialisierung in ihrem Zustand unveränderlich sind. In traditionellen Programmiersprachen wie z.B. 3 | Java bleibt dies jedoch oftmals ein akademischer Ansatz, da oft auf bestehendem Code und bestehenden Bibliotheken 4 | aufgesetzt werden muss, die ein derartiges Programmiermodell nicht oder nur unzulänglich unterstützen. 5 | 6 | Das `modifier`-Plugin schafft eine Möglichkeit, einerseits (z.B. durch das `immutable`-Plugin) die allgemeine 7 | Schnittstelle einer Klasse so zu definieren, dass darüber keine Zustandsänderungen am Objekt möglich sind, 8 | aber gleichzeitig für bestimmte Szenarien eine explizit abzurufende Referenz bereit zu stellen, über die das 9 | Objekt dennoch einfach verändert werden kann. 10 | 11 | Der Einsatz dieses Plugins ist hauptsächlich für eine Übergangszeit während der Refaktorierung von existierendem 12 | Code vorgesehen, sodass zur Compilezeit die Stellen im Code deutlich werden, die zustandsveränderliche 13 | Objekte voraussetzen. Ziel sollte es dann sein, dieses Plugin irgendwann im eigenen Projekt abschalten zu können. -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/PartialCopyGenerator.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in 14 | # all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | # THE SOFTWARE. 23 | # 24 | 25 | javadoc.method.param.propertyTree=A '{'@link PropertyTree'}' that specifies which parts of the source object tree to copy. 26 | javadoc.method.param.propertyTreeUse=A '{'@link PropertyTreeUse'}' value that specifies how the "{0}" parameter will be used: INCLUDE or EXCLUDE. 27 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/PartialCopyGenerator_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mklemm/jaxb-rich-contract-plugin/a0df93a4cc0f3111ace568431dbb9bf7bdee7704/plugin/src/main/resources/com/kscs/util/plugins/xjc/PartialCopyGenerator_de.properties -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/base/PluginUtil.properties: -------------------------------------------------------------------------------- 1 | error.cannot-instantiate-strategy=Exception while instantiating preprocessing strategy: {0}. 2 | error.no-such-constructor=Strategy class {0} has no default constructor. 3 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/base/PluginUtil_de.properties: -------------------------------------------------------------------------------- 1 | error.cannot-instantiate-strategy=Vorverarbeitungsstrategie {0} kann nicht instanziiert werden. 2 | error.no-such-constructor=Strategieklasse {0} hat keinen Standardkonstruktor. 3 | -------------------------------------------------------------------------------- /plugin/src/main/resources/com/kscs/util/plugins/xjc/interface-bindings.xsl: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /plugin/src/main/resources/group-interfaces.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /plugin/src/main/resources/interfaces-episode.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/clone.md: -------------------------------------------------------------------------------- 1 | ## clone 2 | ### Motivation 3 | Another way to create a deep copy of an object tree. This adheres to the `java.lang.Cloneable` contract, but isn't as versatile as `-Xcopy`. 4 | 5 | ### Function 6 | The `clone` plugin generates a deep clone method for each of the generated classes, based on the following assumptions: 7 | 8 | * Objects implementing `java.lang.Cloneable` and are cloneable by their "clone" Method. 9 | * Objects not implementing `java.lang.Cloneable` or primitive types are assumed to be immutable, their references are copied over, they are not cloned. 10 | 11 | ### Bugs 12 | The `-cloneThrows` option should in fact never have existed. 13 | 14 | ### Limitations 15 | There is currently no way for the plugin to determine whether an object in the object graph that isn't cloneable actually is immutable so its reference can be copied. So, there is no guarantee that cloned object graphs are really independent of each other, as mandated by the `java.lang.Cloneable` contract. 16 | 17 | ### Usage 18 | #### -Xclone 19 | 20 | #### Options 21 | 22 | ##### -clone.cloneThrows=`{y|n}` (y) 23 | Declare CloneNotSupportedException to be thrown by 'clone()' (yes), or suppress throws clause and wrap all `CloneNotSupportedException`s as `RuntimeException` (no). 24 | If you set this to `no`, the resulting code will violate the `java.lang.Cloneable` contract, since it is stated that an object that cannot be cloned should throw CloneNotSupportedException, and nothing else. This option has been added, however, to support legacy code that doesn't catch CloneNotSupportedExceptions. 25 | 26 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/clone_de.md: -------------------------------------------------------------------------------- 1 | ## clone 2 | ### Motivation 3 | Another way to create a deep copy of an object tree. This adheres to the `java.lang.Cloneable` contract, but isn't as versatile as `-Xcopy`. 4 | 5 | ### Funktion 6 | The `clone` plugin generates a deep clone method for each of the generated classes, based on the following assumptions: 7 | 8 | * Objects implementing `java.lang.Cloneable` and are cloneable by their "clone" Method. 9 | * Objects not implementing `java.lang.Cloneable` or primitive types are assumed to be immutable, their references are copied over, they are not cloned. 10 | 11 | ### Bugs 12 | The `-cloneThrows` option should in fact never have existed. 13 | 14 | ### Enschränkungen 15 | There is currently no way for the plugin to determine whether an object in the object graph that isn't cloneable actually is immutable so its reference can be copied. So, there is no guarantee that cloned object graphs are really independent of each other, as mandated by the `java.lang.Cloneable` contract. 16 | 17 | ### Aktivierung 18 | #### -Xclone 19 | 20 | #### Optionen 21 | 22 | ##### -clone.cloneThrows=`{y|n}` (y) 23 | 'CloneNotSupportedException' in der Methodensignatur von 'clone()' deklarieren (yes), oder 'throws' weglassen und evtl. Exception intern ignorieren (no). 24 | 25 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/constrained-properties.md: -------------------------------------------------------------------------------- 1 | ## constrained-properties 2 | ### Motivation 3 | Many GUI applications use data binding to connect the data model to the view components. The JavaBeans standard defines a simple component model that also supports properties which send notifications whenever the are about to be changed, and there are even vetoable changes that allow a change listener to inhibit modification of a property. While the JAvaBeans standard is a bit dated, data binding and property change notification can come in handy in many situations, even for debugging or reverse-engineering existing code, because you can track any change made to the model instance. 4 | 5 | ### Function 6 | constrained-properties generates additional code in the property setter methods of the POJOs generated by XJC that allow `PropertyChangeListener`s and `VetoableChangeListener`s to be attached to any instance of a XJC-generated class. 7 | 8 | Currently, **indexed properties** are NOT supported in the way specified by JavaBeans, but instead, if a property represents a collection, a collection proxy class is generated that supports its own set of collection-specific change notifications, vetoable and other. This decision has been made because by default XJC generates collection properties rather than indexed properties, and indexed properties as mandated by JavaBeans are generally considered "out of style". 9 | 10 | ### Limitations 11 | * The JavaBeans standard is only loosely implemented in the generated classes. 12 | * Indexed Properties as defined in JavaBeans are not supported. 13 | * The CollectionChange behavior implemented by the classes is not yet documented and non-standard. 14 | 15 | ### Usage 16 | #### -Xconstrained-properties 17 | 18 | #### Options 19 | 20 | ##### -constrained-properties.constrained=`{y|n}` (y) 21 | switch "constrained" property contract generation on/off. Default: yes 22 | 23 | 24 | ##### -constrained-properties.bound=`{y|n}` (y) 25 | switch "bound" property contract generation on/off. Default: yes 26 | 27 | 28 | ##### -constrained-properties.setterThrows=`{y|n}` (n) 29 | Declare setXXX methods to throw PropertyVetoException (yes), or rethrow as RuntimeException (no). Default: no 30 | 31 | 32 | ##### -constrained-properties.generateTools=`{y|n}` (y) 33 | Generate helper classes needed for collection change event detection. Turn off in modules that import other generated modules. Default: yes 34 | 35 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/constrained-properties_de.md: -------------------------------------------------------------------------------- 1 | ## constrained-properties 2 | ### Motivation 3 | Many GUI applications use data binding to connect the data model to the view components. The JavaBeans standard defines a simple component model that also supports properties which send notifications whenever the are about to be changed, and there are even vetoable changes that allow a change listener to inhibit modification of a property. While the JAvaBeans standard is a bit dated, data binding and property change notification can come in handy in many situations, even for debugging or reverse-engineering existing code, because you can track any change made to the model instance. 4 | 5 | ### Funktion 6 | constrained-properties generates additional code in the property setter methods of the POJOs generated by XJC that allow `PropertyChangeListener`s and `VetoableChangeListener`s to be attached to any instance of a XJC-generated class. 7 | 8 | Currently, **indexed properties** are NOT supported in the way specified by JavaBeans, but instead, if a property represents a collection, a collection proxy class is generated that supports its own set of collection-specific change notifications, vetoable and other. This decision has been made because by default XJC generates collection properties rather than indexed properties, and indexed properties as mandated by JavaBeans are generally considered "out of style". 9 | 10 | ### Enschränkungen 11 | * The JavaBeans standard is only loosely implemented in the generated classes. 12 | * Indexed Properties as defined in JavaBeans are not supported. 13 | * The CollectionChange behavior implemented by the classes is not yet documented and non-standard. 14 | 15 | ### Aktivierung 16 | #### -Xconstrained-properties 17 | 18 | #### Optionen 19 | 20 | ##### -constrained-properties.constrained=`{y|n}` (y) 21 | Erzeuge "constrained properties", die durch das Werfen einer Exception eine Änderung ihres Zustandes unterbinden können. 22 | 23 | 24 | ##### -constrained-properties.bound=`{y|n}` (y) 25 | Erzeuge "bound properties", die die Änderung ihres Zustandes als Event weitermelden. 26 | 27 | 28 | ##### -constrained-properties.setterThrows=`{y|n}` (n) 29 | Wenn Constrained Properties verwendet werden, soll eine PropertyVetoException bei unerlaubter Zustandsänderung geworfen werden. 30 | Wenn dies auf "no" gesetzt ist, wird stattdessen eine "RuntimeException" erzeugt. 31 | 32 | 33 | ##### -constrained-properties.generateTools=`{y|n}` (y) 34 | Generiere die Hilfsklassen, die zur Realisierung der nicht-standardkonformen "Collection Changed" events gebraucht werden, als Quelltext. 35 | 36 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/getting.md: -------------------------------------------------------------------------------- 1 | ### How to get it 2 | 3 | [Full documentation on GitHub](http://mklemm.github.io/jaxb-rich-contract-plugin) 4 | 5 | [Get the source on GitHub](https://github.com/mklemm/jaxb-rich-contract-plugin) 6 | 7 | [Download this project as a .zip file](https://github.com/mklemm/jaxb-rich-contract-plugin/zipball/master) 8 | 9 | [Download this project as a tar.gz file](https://github.com/mklemm/jaxb-rich-contract-plugin/tarball/master) 10 | 11 | Get it with Maven (Now hosted on maven central): 12 | 13 | ``` xml 14 | net.codesup.util 15 | jaxb-rich-contract-plugin 16 | 4.2.1.0 17 | ``` 18 | 19 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/immutable.md: -------------------------------------------------------------------------------- 1 | ## immutable 2 | ### Motivation 3 | Generally it is advisable to make your business classes immutable as much as possible, to minimise side effects and allow for functional programming patterns. 4 | 5 | ### Function 6 | This plugin simply makes all "setXXX" methods "protected", thus preventing API consumers to modify state of instances of generated classes after they have been created. This only makes sense together with another plugin that allows for initialization of the instances, like e.g. the included `fluent-builder` plugin. For collection-valued properties, `-Ximmutable` wraps all collections in a `Collections.unmodifiableCollection`, so collections are also made immutable. Because JAXB serialization has a number of constraints regarding the internals of JAXB serializable objects, it wasn't advisable to just remove the setter methods or replace the collections with unmodifiable collections. So, a bit of additional code will be created that leaves the old "mutable" structure of the class intact as much as is needed for JAXB, but modifies the public interface so objects appear immutable to client code. 7 | 8 | ### Limitations 9 | * Access level "protected" may not be strict enough to prevent state changes. 10 | * If you activate plugins like "fluent-api" or the like, these plugins may circumvent the protection provided by the `immutable` plugin. 11 | 12 | ### Usage 13 | #### -Ximmutable 14 | 15 | #### Options 16 | 17 | ##### -immutable.fake=`{y|n}` (n) 18 | Do not actually make anything immutable. For test and debug purpose only. 19 | 20 | 21 | ##### -immutable.overrideCollectionClass=`` (null) 22 | Modify collection getters to be declared to return a custom type implementing java.lang.Iterable instead of List. 23 | 24 | 25 | ##### -immutable.constructorAccess=`` (public) 26 | Generate constructors of an immutable class with the specified access level ("public", "private", "protected", "default"). By specification, JAXB needs a public no-arg constructor for marshalling and unmarshalling objects to an from XML. It turns out, however, that many implementations support protected constructors as well. 27 | This option has been included since it doesn't make sense to construct an empty object which then cannot be modified, But anyway, use with caution. 28 | 29 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/immutable_de.md: -------------------------------------------------------------------------------- 1 | ## immutable 2 | ### Motivation 3 | Generally it is advisable to make your business classes immutable as much as possible, to minimise side effects and allow for functional programming patterns. 4 | 5 | ### Funktion 6 | This plugin simply makes all "setXXX" methods "protected", thus preventing API consumers to modify state of instances of generated classes after they have been created. This only makes sense together with another plugin that allows for initialization of the instances, like e.g. the included `fluent-builder` plugin. For collection-valued properties, `-Ximmutable` wraps all collections in a `Collections.unmodifiableCollection`, so collections are also made immutable. Because JAXB serialization has a number of constraints regarding the internals of JAXB serializable objects, it wasn't advisable to just remove the setter methods or replace the collections with unmodifiable collections. So, a bit of additional code will be created that leaves the old "mutable" structure of the class intact as much as is needed for JAXB, but modifies the public interface so objects appear immutable to client code. 7 | 8 | ### Enschränkungen 9 | * Access level "protected" may not be strict enough to prevent state changes. 10 | * If you activate plugins like "fluent-api" or the like, these plugins may circumvent the protection provided by the `immutable` plugin. 11 | 12 | ### Aktivierung 13 | #### -Ximmutable 14 | 15 | #### Optionen 16 | 17 | ##### -immutable.fake=`{y|n}` (n) 18 | Nur für Test und Debug: Es wird nichts wirklich unveränderlich gemacht, aber das Plugin bleibt aktiv. 19 | 20 | 21 | ##### -immutable.overrideCollectionClass=`` (null) 22 | Modify collection getters to be declared to return a custom type implementing java.lang.Iterable instead of List. 23 | 24 | 25 | ##### -immutable.constructorAccess=`` (public) 26 | Setzt die Sichtbarkeit des von JAXB geforderten argumentlosen Konstruktors auf den angegebenen Wert ("public", "private", "protected", "default"). Die JAXB-Spezifikation fordert eigentlich, dass der Konstruktor "public" sein soll, aber in vielen Implementierungen funktioniert auch "protected". Diese Option wurde eingeführt, da es normalerweise wenig sinnvoll ist, ein leeres Objekt zu erzeugen, das danach nicht mehr verändert werden kann. Dennoch ist dies nicht standardkonform und daher mit Vorsicht zu benutzen. 27 | 28 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/index.md: -------------------------------------------------------------------------------- 1 | # jaxb-rich-contract-plugin 2 | 3 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.codesup.util/jaxb-rich-contract-plugin/badge.svg?gav=true)](https://maven-badges.herokuapp.com/maven-central/net.codesup.util/jaxb-rich-contract-plugin/?gav=true) 4 | 5 | ## A collection of JAXB / XJC plugins to generate advanced contract scenarios from XSD 6 | 7 | This module is a collection of several plugins for the JAXB2 (Java API for XML binding) "XSD to Java Compiler" (XJC). 8 | These plugins are intended to add support for additional contracts to the classes generated by XJC. Currently, there are 7 plugin classes: 9 | 10 | 1. **[fluent-builder][1]**: Generates a builder class for every class generated. Builders are implemented as inner classes, static methods are provided for a fluent builder pattern in the form `MyClass.builder().withPropertyA(...).withPropertyB(...).build()`. Builders also contain "copy..." methods to initialize the builder from another instance. Partial copying is also supported in the same way as in **copy**. 11 | This is particularly useful together with `-Ximmutable` (see above), but not usable together with `-Xconstrained-properties` (see below). 12 | fluent-builder offers a bunch of cool stuff usually not found in standard builder generators, such as generating builder from existing instances with optional partial copying, chained builders, `` expansion, etc. 13 | 2. **[immutable][2]**: Will make generated classes immutable. Only makes sense together with "fluent-builder" plugin (see below), or any other builder or initialisation facility, like the well-known "value-constructor" plugin. 14 | 3. **[group-contract][3]**: When using `` or `` elements in an XSD, they are transformed as interface definitions, and any complexTypes using the groups will be generated as classes implementing this interface. 15 | 4. **[clone][4]**: Will generate a simple deep "clone" method for the generated classes based on the heuristic that it only makes sense to traverse further down in the cloned object tree for members of types that are actually cloenable themselves. 16 | 5. **[copy][5]**: Similar to "clone", will generate a simple deep "createCopy" method. The java API contract for the `java.lang.Cloneable` interface and the rules for overriding `Object.clone()` are defective by design. So the "copy" plugin uses its own API to realize the desired behavior. Also can generate a "partial createCopy" method, that takes a `PropertyTree` object which represents an include/exclude rule for nodes in the object tree to clone. Excluded nodes will not be cloned and left alone. Optionally, corresponding copy constructors can also be generated. 17 | 6. **[constrained-properties][6]**: Will generate a complexTypes element members as bound and/or constrained properties as per the JavaBeans spec. 18 | 7. **[meta][7]**: Generates a nested class representing a static metamodel of the generated classes. In the "enhanced" version, this contains information about the type and the XSD element from which the property was generated, in "simple" mode, there are only constants for the property names. 19 | 20 | [1]: fluent-builder.html 21 | [2]: immutable.html 22 | [3]: group-contract.html 23 | [4]: clone.html 24 | [5]: copy.html 25 | [6]: constrained-properties.html 26 | [7]: meta.html 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/meta.md: -------------------------------------------------------------------------------- 1 | ## meta 2 | ### Motivation 3 | Sometimes, you need information about the properties of a class, or you wish to have a constant for the names of properties. 4 | The "meta" plugin creates an inner class (the name of which can be controlled by a command-line option), and adds a constant 5 | field for each property. If the `-extended=y` command-line option is specified, these constants will hold instances of the 6 | `PropertyInfo` class, on which the name, type, multiplicity (collection or not) and default value (from XSD) are exposed. 7 | Without `-extended`, the constants are simply string constants holding the property names. 8 | 9 | As a new feature in version 1.10, a visitor pattern has been added that allows to visit all properties of 10 | an object graph. 11 | 12 | 13 | ### Usage 14 | #### -Xmeta 15 | 16 | #### Options 17 | 18 | ##### -meta.generateTools=`{y|n}` (y) 19 | Generate helper class used to represent extended metadata as source code. 20 | If this is set to "n" and "-extended=y", the plugin JAR will have to be in the runtime classpath of the client application. 21 | 22 | 23 | ##### -meta.extended=`{y|n}` (n) 24 | Generate extended meta data for each property: Name, type, multiplicity, default value. 25 | 26 | 27 | ##### -meta.camelCase=`{y|n}` (n) 28 | Generate names of constant meta fields like field names, instead of Java constant name convention. 29 | 30 | 31 | ##### -meta.metaClassName=`` (PropInfo) 32 | Name of the generated meta-information nested class. 33 | 34 | 35 | ##### -meta.allowSet=`{y|n}` (y) 36 | Allow property values to be set via property meta information. 37 | 38 | 39 | ##### -meta.visitMethodName=`` (visit) 40 | Name of the method to apply a visitor. 41 | 42 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/meta_de.md: -------------------------------------------------------------------------------- 1 | ## meta 2 | ### Motivation 3 | Sometimes, you need information about the properties of a class, or you wish to have a constant for the names of properties. 4 | The "meta" plugin creates an inner class (the name of which can be controlled by a command-line option), and adds a constant 5 | field for each property. If the `-extended=y` command-line option is specified, these constants will hold instances of the 6 | `PropertyInfo` class, on which the name, type, multiplicity (collection or not) and default value (from XSD) are exposed. 7 | Without `-extended`, the constants are simply string constants holding the property names. 8 | 9 | In Version 1.10 wurde neu ein "Visitor"-Muster eingeführt, über das sich der gesamte Objektgraph durchlaufen lässt. 10 | 11 | 12 | ### Aktivierung 13 | #### -Xmeta 14 | 15 | #### Optionen 16 | 17 | ##### -meta.generateTools=`{y|n}` (y) 18 | Generiere die Hilfsklasse zur Darstellung der erweiterten Metadaten als Quelltext. 19 | Wenn hier "n" angegeben wird und "extended=y", so muss das plugin JAR zur Laufzeit im Klassenpfad der client-Anwendung sein. 20 | 21 | 22 | ##### -meta.extended=`{y|n}` (n) 23 | Generiere erweiterte Metadaten für jedes Property: Name, Typ, Multiplizität, Standardwert 24 | 25 | 26 | ##### -meta.camelCase=`{y|n}` (n) 27 | Namen der Konstanten wie Feldnamen generieren, nicht nach Java-Konstanten-Konvention. 28 | 29 | 30 | ##### -meta.metaClassName=`` (PropInfo) 31 | Name der generierten inneren Metainfoklasse. 32 | 33 | 34 | ##### -meta.allowSet=`{y|n}` (y) 35 | Generiere eine Möglichkeit, den Wert eines Propertys über die Metadaten zu ändern. 36 | 37 | 38 | ##### -meta.visitMethodName=`` (visit) 39 | Name der Methode, mit der ein Visitor durch das Objekt geschickt werden kann. 40 | 41 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/modifier.md: -------------------------------------------------------------------------------- 1 | ## modifier 2 | ### Motivation 3 | In general, you may wish to implement application logic in a way so that objects are initialized once 4 | and then are immutable. 5 | For traditional programming languages, like Java, for example, this is not always feasible in practice, 6 | because legacy code and libraries have to be used. 7 | 8 | With the `modifier` plugin, you can make the public interface of your classes immutable via the `immutable` 9 | plugin, but at the same time provide a handle to modify the state of your objects anyway vi a reference that 10 | needs to be queried explicitly. 11 | 12 | This plugin is intended for use while refactoring existing code to a more "functional" and thread-friendly 13 | code base. Eventually, your code should work so this plugin can be deactivated in your XJC configuration. 14 | 15 | 16 | ### Function 17 | This plugin creates an inner class with public setXXX methods, and getXXX methods for collection properties that 18 | return a writable version of the collection the property is implemented by. 19 | 20 | If the `group-contract` plugin is also activated, these constructs will also be generated into the interfaces. 21 | 22 | 23 | ### Usage 24 | #### -Xmodifier 25 | 26 | #### Options 27 | 28 | ##### -modifier.modifierClassName=`` (Modifier) 29 | Name of the generated inner class that allows to modify the state of generated objects. 30 | 31 | 32 | ##### -modifier.modifierMethodName=`` (modifier) 33 | Name of the generated method that allows to instantiate the modifier class. 34 | 35 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/modifier_de.md: -------------------------------------------------------------------------------- 1 | ## modifier 2 | ### Motivation 3 | Generell ist es vorteilhaft, Anwendungslogik so zu implementieren, dass Objekte in der Regel nach der 4 | Initialisierung in ihrem Zustand unveränderlich sind. In traditionellen Programmiersprachen wie z.B. 5 | Java bleibt dies jedoch oftmals ein akademischer Ansatz, da oft auf bestehendem Code und bestehenden Bibliotheken 6 | aufgesetzt werden muss, die ein derartiges Programmiermodell nicht oder nur unzulänglich unterstützen. 7 | 8 | Das `modifier`-Plugin schafft eine Möglichkeit, einerseits (z.B. durch das `immutable`-Plugin) die allgemeine 9 | Schnittstelle einer Klasse so zu definieren, dass darüber keine Zustandsänderungen am Objekt möglich sind, 10 | aber gleichzeitig für bestimmte Szenarien eine explizit abzurufende Referenz bereit zu stellen, über die das 11 | Objekt dennoch einfach verändert werden kann. 12 | 13 | Der Einsatz dieses Plugins ist hauptsächlich für eine Übergangszeit während der Refaktorierung von existierendem 14 | Code vorgesehen, sodass zur Compilezeit die Stellen im Code deutlich werden, die zustandsveränderliche 15 | Objekte voraussetzen. Ziel sollte es dann sein, dieses Plugin irgendwann im eigenen Projekt abschalten zu können. 16 | 17 | 18 | ### Funktion 19 | Es wird eine innere Klasse generiert, die öffentliche setXXX-Methoden und getXXX-Methoden für Collections enthält, wobei 20 | schreibbare Collection-Instanzen zurückgegeben werden. 21 | 22 | Wenn das `group-contract`-Plugin ebenfalls aktiviert ist, werden diese Konstrukte auch in den Interfaces erzeugt. 23 | 24 | 25 | ### Aktivierung 26 | #### -Xmodifier 27 | 28 | #### Optionen 29 | 30 | ##### -modifier.modifierClassName=`` (Modifier) 31 | Name der generierten Mutator-Klasse 32 | 33 | 34 | ##### -modifier.modifierMethodName=`` (modifier) 35 | Name der generierten methode zum Abruf einer Instanz der Mutator-Klasse 36 | 37 | -------------------------------------------------------------------------------- /plugin/src/site/resources/images/bg_hr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mklemm/jaxb-rich-contract-plugin/a0df93a4cc0f3111ace568431dbb9bf7bdee7704/plugin/src/site/resources/images/bg_hr.png -------------------------------------------------------------------------------- /plugin/src/site/resources/images/blacktocat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mklemm/jaxb-rich-contract-plugin/a0df93a4cc0f3111ace568431dbb9bf7bdee7704/plugin/src/site/resources/images/blacktocat.png -------------------------------------------------------------------------------- /plugin/src/site/resources/images/icon_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mklemm/jaxb-rich-contract-plugin/a0df93a4cc0f3111ace568431dbb9bf7bdee7704/plugin/src/site/resources/images/icon_download.png -------------------------------------------------------------------------------- /plugin/src/site/resources/images/sprite_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mklemm/jaxb-rich-contract-plugin/a0df93a4cc0f3111ace568431dbb9bf7bdee7704/plugin/src/site/resources/images/sprite_download.png -------------------------------------------------------------------------------- /plugin/src/site/resources/javascripts/main.js: -------------------------------------------------------------------------------- 1 | console.log('This would be the main JS file.'); 2 | -------------------------------------------------------------------------------- /plugin/src/site/resources/stylesheets/usage.css: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | body { 26 | font-family: sans-serif; 27 | margin-left: 6em; 28 | margin-right: 6em; 29 | } 30 | 31 | p { 32 | margin-top: 0; 33 | margin-left: 8pt; 34 | margin-right: 8pt; 35 | } 36 | 37 | h1:before { 38 | color: gray; 39 | content: "-X"; 40 | } 41 | h1 { 42 | font-weight: bold; 43 | font-size: 18pt; 44 | color: brown; 45 | padding: 2pt; 46 | margin-bottom: 0; 47 | } 48 | 49 | h2 { 50 | font-weight: bold; 51 | color: saddlebrown; 52 | font-size: 12pt; 53 | font-variant-caps: small-caps; 54 | padding: 2pt; 55 | margin-bottom: 0; 56 | } 57 | dl { 58 | margin-top: 0; 59 | margin-left: 10pt; 60 | margin-right: 10pt; 61 | } 62 | dt { 63 | color: peru; 64 | } 65 | 66 | dd { 67 | padding-bottom: 8pt; 68 | } 69 | 70 | span.default { 71 | width: 60%; 72 | float: right; 73 | text-align: right; 74 | font-style: italic; 75 | } 76 | 77 | span.default:before { 78 | color:gray; 79 | font-style: normal; 80 | content: '(default: "'; 81 | } 82 | span.default:after { 83 | color:gray; 84 | font-style: normal; 85 | content: '")'; 86 | } 87 | 88 | span.choice { 89 | font-style: italic; 90 | color: coral; 91 | } -------------------------------------------------------------------------------- /plugin/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | org.apache.maven.skins 7 | maven-fluido-skin 8 | 2.0.0-M8 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /plugin/src/test/java/com/kscs/util/plugins/xjc/base/PluginUsageBuilderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.plugins.xjc.base; 25 | 26 | import com.kscs.util.plugins.xjc.BoundPropertiesPlugin; 27 | import com.kscs.util.plugins.xjc.DeepClonePlugin; 28 | import com.kscs.util.plugins.xjc.DeepCopyPlugin; 29 | import com.kscs.util.plugins.xjc.FluentBuilderPlugin; 30 | import com.kscs.util.plugins.xjc.GroupInterfacePlugin; 31 | import com.kscs.util.plugins.xjc.ImmutablePlugin; 32 | import com.kscs.util.plugins.xjc.MetaPlugin; 33 | import org.junit.Test; 34 | 35 | /** 36 | * Test usage output 37 | */ 38 | public class PluginUsageBuilderTest { 39 | @Test 40 | public void testPluginUsageFluentBuilder() { 41 | final FluentBuilderPlugin plugin = new FluentBuilderPlugin(); 42 | System.out.println(plugin.getUsage()); 43 | } 44 | 45 | @Test 46 | public void testPluginUsageImmutable() { 47 | final ImmutablePlugin plugin = new ImmutablePlugin(); 48 | System.out.println(plugin.getUsage()); 49 | } 50 | 51 | @Test 52 | public void testPluginUsageGroupContract() { 53 | final GroupInterfacePlugin plugin = new GroupInterfacePlugin(); 54 | System.out.println(plugin.getUsage()); 55 | } 56 | 57 | @Test 58 | public void testPluginUsageDeepClone() { 59 | final DeepClonePlugin plugin = new DeepClonePlugin(); 60 | System.out.println(plugin.getUsage()); 61 | } 62 | 63 | @Test 64 | public void testPluginUsageDeepCopy() { 65 | final DeepCopyPlugin plugin = new DeepCopyPlugin(); 66 | System.out.println(plugin.getUsage()); 67 | } 68 | 69 | @Test 70 | public void testPluginUsageBoundProperties() { 71 | final BoundPropertiesPlugin plugin = new BoundPropertiesPlugin(); 72 | System.out.println(plugin.getUsage()); 73 | } 74 | 75 | @Test 76 | public void testPluginUsageMeta() { 77 | final MetaPlugin plugin = new MetaPlugin(); 78 | System.out.println(plugin.getUsage()); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /plugin/src/test/resources/XInclude.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The XInclude definition is at http://www.w3.org/TR/xinclude/. This now has a namespace reference to 6 | http://www.w3.org/2001/XInclude and the http://www.w3.org/2003/XInclude reference is deprecated. 7 | The only real addition to or difference from the 2001 definition is the accept-charset attribute of element include. 8 | However, for immediate ease of use the 2003 namespace is retained in version 0.2 of the 9 | WMO19115 Community Core Profile - this physical instance document. It is referenced as ./XInclude.xsd in the 10 | version 0.2 WMO file list. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /plugin/src/test/resources/binding-config-custom-list.xjb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /plugin/src/test/resources/binding-config-default-value.xjb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /plugin/src/test/resources/binding-config-group-interface.xjb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /plugin/src/test/resources/binding-config-idrefs.xjb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /plugin/src/test/resources/binding-config-xhtml.xjb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /plugin/src/test/resources/binding-config.xjb: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /plugin/src/test/resources/catalog.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /plugin/src/test/resources/custom-list-test.xsd: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /plugin/src/test/resources/default-value-test.xsd: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /plugin/src/test/resources/group-interface-test.xsd: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /plugin/src/test/resources/idrefs-test.xsd: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /plugin/src/test/resources/math.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /plugin/src/test/resources/netex.xsd: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /plugin/src/test/resources/siri.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | Requested end time for subscription. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Type for reference to a TRAIN NUMBER 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Type for identifier of an TRAIN NUMBER 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /plugin/src/test/resources/svg.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 4.0.0 7 | 8 | jaxb-rich-contract-plugin-parent 9 | 4.2.1-SNAPSHOT 10 | https://mklemm.github.io/jaxb-rich-contract-plugin 11 | 12 | 13 | net.codesup.util 14 | jaxb-plugin-parent 15 | 2.1.1.1 16 | 17 | 18 | JAXB XJC extended contract generation plugin parent 19 | pom 20 | 21 | Provides a number of plugins for the JAXB (Java API for XML binding) 22 | XML-Schema-to-Java compiler (XJC), that enhance the generated source code 23 | with various and configurable aspects, like "fluent builder" patterns, 24 | generating interface contracts from group and attributeGroup declarations, 25 | generating JavaBeans(TM) bound and constrained properties, copy methods and -constructors, 26 | selective object graph copying, meta data generation etc. 27 | 28 | 29 | 30 | scm:git:https://github.com/mklemm/jaxb-rich-contract-plugin.git 31 | scm:git:https://github.com/mklemm/jaxb-rich-contract-plugin.git 32 | https://github.com/mklemm/jaxb-rich-contract-plugin 33 | HEAD 34 | 35 | 36 | 37 | plugin 38 | runtime 39 | test 40 | 41 | 42 | 43 | github 44 | scm:git:https://github.com/mklemm/ 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /runtime/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 4.0.0 7 | 8 | jaxb-rich-contract-runtime 9 | 10 | 11 | net.codesup.util 12 | jaxb-rich-contract-plugin-parent 13 | 4.2.1-SNAPSHOT 14 | 15 | 16 | JAXB rich-contract-plugin generated code runtime dependencies 17 | jar 18 | 19 | Runtime classes needed by the code that was generated with one of the JAXB rich-contract-plugins. 20 | (see https://github.com/mklemm/jaxb2-rich-contract-plugin) 21 | 22 | http://mklemm.github.io/jaxb-rich-contract-runtime 23 | 24 | 25 | scm:git:https://github.com/mklemm/jaxb-rich-contract-runtime.git 26 | scm:git:https://github.com/mklemm/jaxb-rich-contract-runtime.git 27 | http://mklemm.github.io/jaxb-rich-contract-runtime 28 | HEAD 29 | 30 | 31 | 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-javadoc-plugin 36 | 3.0.1 37 | 38 | none 39 | 40 | 41 | 42 | org.apache.maven.plugins 43 | maven-source-plugin 44 | 45 | 46 | attach-sources 47 | 48 | jar 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/BoundList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * @author klemm0 2014-03-27 31 | * Created by jaxb-rich-contract-plugin. 32 | * Defines the contract for a List implementaion 33 | * that supports change and vetoable change events. 34 | */ 35 | public interface BoundList extends List { 36 | void addCollectionChangeListener(final CollectionChangeListener collectionChangeListener); 37 | void addVetoableCollectionChangeListener(final VetoableCollectionChangeListener vetoableCollectionChangeListener); 38 | } 39 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/Buildable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | /** 28 | * @author Mirko Klemm 2015-09-03 29 | */ 30 | public interface Buildable { 31 | Object build(); 32 | 33 | class PrimitiveBuildable implements Buildable { 34 | private final Object content; 35 | 36 | public PrimitiveBuildable(final Object content) { 37 | this.content = content; 38 | } 39 | 40 | public Object getContent() { 41 | return this.content; 42 | } 43 | 44 | @Override 45 | public Object build() { 46 | return this.content; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/CollectionChangeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import java.util.Collection; 28 | 29 | /** 30 | * @author klemm0 2014-03-27 31 | * 32 | */ 33 | public class CollectionChangeEvent { 34 | private final Collection source; 35 | private final String methodName; 36 | private final CollectionChangeEventType eventType; 37 | private final Collection oldItems; 38 | private final Collection newItems; 39 | private final int index; 40 | 41 | public CollectionChangeEvent(final Collection source, final String methodName, final CollectionChangeEventType eventType, final Collection oldItems, final Collection newItems, final int index) { 42 | this.source = source; 43 | this.methodName = methodName; 44 | this.eventType = eventType; 45 | this.oldItems = oldItems; 46 | this.newItems = newItems; 47 | this.index = index; 48 | } 49 | 50 | public Collection getSource() { 51 | return this.source; 52 | } 53 | 54 | public String getMethodName() { 55 | return this.methodName; 56 | } 57 | 58 | public CollectionChangeEventType getEventType() { 59 | return this.eventType; 60 | } 61 | 62 | public Collection getOldItems() { 63 | return this.oldItems; 64 | } 65 | 66 | public Collection getNewItems() { 67 | return this.newItems; 68 | } 69 | 70 | public int getIndex() { 71 | return this.index; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/CollectionChangeEventType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | /** 28 | * @author klemm0 2014-03-27 29 | * 30 | */ 31 | public enum CollectionChangeEventType { 32 | REMOVE, ADD_ALL, ADD_ALL_AT, REMOVE_ALL, RETAIN_ALL, SET_AT, ADD_AT, REMOVE_AT, ADD 33 | } 34 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/CollectionChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | /** 28 | * @author klemm0 2014-03-27 29 | * 30 | */ 31 | public interface CollectionChangeListener { 32 | void collectionChange(final CollectionChangeEvent event); 33 | } 34 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/CollectionProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * Represents the instance of a {@link CollectionPropertyInfo}, i.e. represents the 31 | * property meta information along with its value, and enables to get and set the value 32 | */ 33 | public class CollectionProperty extends Property { 34 | public CollectionProperty(final CollectionPropertyInfo info, final I owner) { 35 | super(info, owner); 36 | } 37 | 38 | @Override 39 | public CollectionPropertyInfo getInfo() { 40 | return (CollectionPropertyInfo)super.getInfo(); 41 | } 42 | 43 | @Override 44 | public List

get() { 45 | return getInfo().get(getOwner()); 46 | } 47 | 48 | public void set(final List

values) { 49 | getInfo().set(getOwner(), values); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/CollectionPropertyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import java.util.List; 28 | 29 | import javax.xml.namespace.QName; 30 | 31 | /** 32 | * Represents a multi-value property of a JAXB-generated java class. 33 | */ 34 | public abstract class CollectionPropertyInfo extends PropertyInfo { 35 | protected CollectionPropertyInfo(final String propertyName, final Class declaringClass, final Class

declaredType, final boolean collection, final P defaultValue, final QName schemaName, final QName schemaType, final boolean attribute) { 36 | super(propertyName, declaringClass, declaredType, collection, defaultValue, schemaName, schemaType, attribute); 37 | } 38 | 39 | @Override 40 | public abstract List

get(final I instance); 41 | 42 | public abstract void set(final I instance, final List

values); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/Copyable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.jaxb; 25 | 26 | /** 27 | * Contract for objects that can be copied, 28 | * similar to the "Object.clone()" contract, 29 | * but only available on objects explicitly implementing 30 | * this interface. 31 | */ 32 | public interface Copyable> { 33 | T createCopy(); 34 | } 35 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/IndirectCollectionProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import java.util.List; 28 | 29 | import jakarta.xml.bind.JAXBElement; 30 | 31 | /** 32 | * Represents the instance of a {@link IndirectCollectionPropertyInfo}, i.e. represents the 33 | * property meta information along with its value, and enables to get an d set the value 34 | */ 35 | public class IndirectCollectionProperty extends Property { 36 | public IndirectCollectionProperty(final PropertyInfo info, final I owner) { 37 | super(info, owner); 38 | } 39 | 40 | @Override 41 | public IndirectCollectionPropertyInfo getInfo() { 42 | return (IndirectCollectionPropertyInfo)super.getInfo(); 43 | } 44 | 45 | @Override 46 | public List> get() { 47 | return getInfo().get(getOwner()); 48 | } 49 | 50 | public void set(final List> values) { 51 | getInfo().set(getOwner(), values); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/IndirectCollectionPropertyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import java.util.List; 28 | 29 | import jakarta.xml.bind.JAXBElement; 30 | import javax.xml.namespace.QName; 31 | 32 | /** 33 | * Represents a multi-value property of a JAXB-generated java class where the individual values are wrapped in 34 | * a {@link JAXBElement} instance. 35 | */ 36 | public abstract class IndirectCollectionPropertyInfo extends PropertyInfo { 37 | protected IndirectCollectionPropertyInfo(final String propertyName, final Class declaringClass, final Class

declaredType, final boolean collection, final P defaultValue, final QName schemaName, final QName schemaType, final boolean attribute) { 38 | super(propertyName, declaringClass, declaredType, collection, defaultValue, schemaName, schemaType, attribute); 39 | } 40 | 41 | @Override 42 | public abstract List> get(final I i) ; 43 | 44 | public abstract void set(final I instance, final List> values); 45 | } 46 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/IndirectPrimitiveCollectionProperty.java: -------------------------------------------------------------------------------- 1 | package com.kscs.util.jaxb; 2 | 3 | import java.util.List; 4 | 5 | import jakarta.xml.bind.JAXBElement; 6 | 7 | /** 8 | * Represents the instance of a {@link IndirectPrimitiveCollectionPropertyInfo}, i.e. represents the 9 | * property meta information along with its value, and enables to get an d set the value 10 | */ 11 | public class IndirectPrimitiveCollectionProperty extends Property { 12 | public IndirectPrimitiveCollectionProperty(final PropertyInfo info, final I owner) { 13 | super(info, owner); 14 | } 15 | 16 | @Override 17 | public IndirectPrimitiveCollectionPropertyInfo getInfo() { 18 | return (IndirectPrimitiveCollectionPropertyInfo)super.getInfo(); 19 | } 20 | 21 | @Override 22 | public List> get() { 23 | return getInfo().get(getOwner()); 24 | } 25 | 26 | public void set(final List> values) { 27 | getInfo().set(getOwner(), values); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/IndirectPrimitiveCollectionPropertyInfo.java: -------------------------------------------------------------------------------- 1 | package com.kscs.util.jaxb; 2 | 3 | import java.util.List; 4 | 5 | import javax.xml.namespace.QName; 6 | 7 | import jakarta.xml.bind.JAXBElement; 8 | 9 | /** 10 | * Represents a multi-value property of a JAXB-generated java class where the individual values are wrapped in 11 | * a {@link JAXBElement} instance, and the individual values are of a java primitive type. 12 | */ 13 | public abstract class IndirectPrimitiveCollectionPropertyInfo extends PropertyInfo { 14 | protected IndirectPrimitiveCollectionPropertyInfo(final String propertyName, final Class declaringClass, final Class

declaredType, final boolean collection, final P defaultValue, final QName schemaName, final QName schemaType, final boolean attribute) { 15 | super(propertyName, declaringClass, declaredType, collection, defaultValue, schemaName, schemaType, attribute); 16 | } 17 | 18 | @Override 19 | public abstract List> get(final I i) ; 20 | 21 | public abstract void set(final I instance, final List> values); 22 | } 23 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/ItemProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | /** 28 | * @author Mirko Klemm 2015-10-16 29 | */ 30 | public class ItemProperty extends Property { 31 | final P value; 32 | final int index; 33 | 34 | public ItemProperty(final CollectionPropertyInfo info, final I owner, final P value, final int index) { 35 | super(info, owner); 36 | this.value = value; 37 | this.index = index; 38 | } 39 | 40 | @Override 41 | public CollectionPropertyInfo getInfo() { 42 | return (CollectionPropertyInfo)super.getInfo(); 43 | } 44 | 45 | @Override 46 | public P get() { 47 | return this.value; 48 | } 49 | 50 | public int getIndex() { 51 | return this.index; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/PartialCopyable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.jaxb; 25 | 26 | /** 27 | * Contract for objects that can be copied partially, 28 | * i.e. by explicitly excluding or including specified 29 | * branches of the object tree. 30 | */ 31 | public interface PartialCopyable> { 32 | 33 | /** 34 | * Clones this instances partially, the parts 35 | * will be defined by propertyTree 36 | * 37 | * @param propertyTree Defines which parts of the object tree will be cloned or excluded 38 | * @param propertyTreeUse Defines how the clone graph will be used: To include or to exclude properties. 39 | * @return A copy of the original object. 40 | */ 41 | T createCopy(final PropertyTree propertyTree, final PropertyTreeUse propertyTreeUse); 42 | 43 | /** 44 | * Clones this instances partially, the parts 45 | * to be EXCLUDED will be defined by propertyTree 46 | * 47 | * @param propertyTree Defines which parts of the object tree will be excluded 48 | * @return A copy of the original object. 49 | */ 50 | T copyExcept(final PropertyTree propertyTree); 51 | 52 | /** 53 | * Clones this instances partially, the parts 54 | * to be INCLUDED will be defined by propertyTree, 55 | * all other parts will be excluded. 56 | * 57 | * @param propertyTree Defines which parts of the object tree will be included in the clone 58 | * @return A copy of the original object. 59 | */ 60 | T copyOnly(final PropertyTree propertyTree); 61 | } 62 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/Property.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | /** 28 | * Abstract base class for all property instances of a JAXB-generated class's instances. 29 | */ 30 | public abstract class Property { 31 | private final PropertyInfo info; 32 | private final I owner; 33 | 34 | protected Property(final PropertyInfo info, final I owner) { 35 | this.info = info; 36 | this.owner = owner; 37 | } 38 | 39 | public PropertyInfo getInfo() { 40 | return this.info; 41 | } 42 | 43 | public I getOwner() { 44 | return this.owner; 45 | } 46 | 47 | public Object get() { 48 | return this.info.get(this.owner); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/PropertyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.jaxb; 25 | 26 | import javax.xml.namespace.QName; 27 | 28 | /** 29 | * Represents a property of a JAXB-generated class. 30 | * @param The type declaring the property 31 | * @param

The type of the property 32 | */ 33 | public abstract class PropertyInfo { 34 | public final String propertyName; 35 | public final Class

declaredType; 36 | public final Class declaringClass; 37 | public final boolean collection; 38 | public final P defaultValue; 39 | public final QName schemaType; 40 | public final boolean attribute; 41 | public final QName schemaName; 42 | 43 | protected PropertyInfo(final String propertyName, final Class declaringClass, final Class

declaredType, final boolean collection, final P defaultValue, final QName schemaName, final QName schemaType, final boolean attribute) { 44 | this.propertyName = propertyName; 45 | this.declaredType = declaredType; 46 | this.declaringClass = declaringClass; 47 | this.collection = collection; 48 | this.defaultValue = defaultValue; 49 | this.schemaType = schemaType; 50 | this.attribute = attribute; 51 | this.schemaName = schemaName; 52 | } 53 | 54 | public abstract Object get(final I instance); 55 | 56 | @Override 57 | public boolean equals(final Object o) { 58 | if (this == o) return true; 59 | if (!(o instanceof PropertyInfo)) return false; 60 | final PropertyInfo that = (PropertyInfo)o; 61 | if (!this.propertyName.equals(that.propertyName)) return false; 62 | return declaringClass.equals(that.declaringClass); 63 | } 64 | 65 | @Override 66 | public int hashCode() { 67 | int result = this.propertyName.hashCode(); 68 | result = 31 * result + this.declaringClass.hashCode(); 69 | return result; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/PropertyTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.jaxb; 25 | 26 | /** 27 | * @author mirko 2014-04-07 28 | */ 29 | public interface PropertyTransformer { 30 | TProperty transform(final PropertyInfo propertyInfo, final TInstance sourceInstance, final TProperty sourcePropertyValue); 31 | } 32 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/PropertyTreeUse.java: -------------------------------------------------------------------------------- 1 | package com.kscs.util.jaxb; 2 | 3 | /** 4 | * @author mirko 2014-06-04 5 | */ 6 | public enum PropertyTreeUse { 7 | INCLUDE, 8 | EXCLUDE 9 | } 10 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/PropertyVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | /** 28 | * Interface to be implemented by a property visitor 29 | */ 30 | public interface PropertyVisitor { 31 | /** 32 | * Called upon visiting a top-level object 33 | * @param value The Object to be visited 34 | */ 35 | void visit(final Object value); 36 | 37 | /** 38 | * Called upon visitng a collection element 39 | * @param property The property being visited 40 | * @return true if visiting shall continue, false if visiting should be finished 41 | */ 42 | boolean visit(final ItemProperty property); 43 | 44 | /** 45 | * Called upon visitng a single-value property 46 | * @param property The property being visited 47 | * @return true if visiting shall continue, false if visiting should be finished 48 | */ 49 | boolean visit(final SingleProperty property); 50 | 51 | /** 52 | * Called upon visiting a collection property 53 | * @param property The property being visited 54 | * @return true if visiting shall continue, false if visiting should be finished 55 | */ 56 | boolean visit(final CollectionProperty property); 57 | 58 | 59 | /** 60 | * Called upon visiting a collection property, where the collection items are wrapped in a 61 | * {@link jakarta.xml.bind.JAXBElement} instance. 62 | * @param property The property being visited 63 | * @return true if visiting shall continue, false if visiting should be finished 64 | */ 65 | boolean visit(final IndirectCollectionProperty property); 66 | 67 | /** 68 | * Called upon visiting a collection property, where the collection items are wrapped in a 69 | * {@link jakarta.xml.bind.JAXBElement} instance and are of a java primitive type 70 | * @param property The property being visited 71 | * @return true if visiting shall continue, false if visiting should be finished 72 | */ 73 | boolean visit(final IndirectPrimitiveCollectionProperty property); 74 | } 75 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/Selector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.jaxb; 25 | 26 | import java.util.Collections; 27 | import java.util.Map; 28 | 29 | /** 30 | * Helper class acting as base class for all selectors and 31 | * concrete implementation of leaf selectors. 32 | * @author mirko 2014-04-04 33 | */ 34 | public class Selector, TParent> { 35 | public final TRoot _root; 36 | public final TParent _parent; 37 | protected final String _propertyName; 38 | protected final boolean _include; 39 | 40 | @SuppressWarnings("unchecked") 41 | public Selector(final TRoot root, final TParent parent, final String propertyName, final boolean include) { 42 | this._root = root == null ? (TRoot) this : root; 43 | this._parent = parent; 44 | this._propertyName = propertyName; 45 | this._include = include; 46 | } 47 | 48 | public Selector(final TRoot root, final TParent parent, final String propertyName) { 49 | this(root, parent, propertyName, true); 50 | } 51 | 52 | /** 53 | * This is only used by builders and other implementational details 54 | * @return A map representing the child nodes of this selector 55 | */ 56 | public Map buildChildren() { 57 | return Collections.emptyMap(); 58 | } 59 | 60 | /** 61 | * Builds a property tree specified by this selector 62 | * @return A property tree specified by this selector 63 | */ 64 | public PropertyTree build() { 65 | return this._root.init(); 66 | } 67 | 68 | /** 69 | * This is only used by builders and other implementational details 70 | * @return A property tree specified by this selector 71 | */ 72 | public PropertyTree init() { 73 | return new PropertyTree(this._propertyName, buildChildren()); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/SingleProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | /** 28 | * Represents the instance of a {@link SinglePropertyInfo}, i.e. represents the 29 | * property meta information along with its value, and enables to get an d set the value 30 | */ 31 | public class SingleProperty extends Property { 32 | 33 | public SingleProperty(final SinglePropertyInfo info, final I owner) { 34 | super(info, owner); 35 | } 36 | 37 | @Override 38 | public SinglePropertyInfo getInfo() { 39 | return (SinglePropertyInfo)super.getInfo(); 40 | } 41 | 42 | @Override 43 | public P get() { 44 | return (P)super.get(); 45 | } 46 | 47 | public void set(final P value) { 48 | getInfo().set(getOwner(), value); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/SinglePropertyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import javax.xml.namespace.QName; 28 | 29 | /** 30 | * Represents a multi-value property of a JAXB-generated java class. 31 | */ 32 | public abstract class SinglePropertyInfo extends PropertyInfo { 33 | protected SinglePropertyInfo(final String propertyName, final Class declaringClass, final Class

declaredType, final boolean collection, final P defaultValue, final QName schemaName, final QName schemaType, final boolean attribute) { 34 | super(propertyName, declaringClass, declaredType, collection, defaultValue, schemaName, schemaType, attribute); 35 | } 36 | 37 | @Override 38 | public abstract P get(final I instance); 39 | public abstract void set(final I instance, final P value); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/UnmodifiableListAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import java.util.Collection; 28 | import java.util.Collections; 29 | import java.util.Iterator; 30 | import java.util.List; 31 | 32 | /** 33 | * @author Mirko Klemm 2015-03-15 34 | */ 35 | public class UnmodifiableListAdapter implements UnmodifiableList { 36 | private final List delegateList; 37 | 38 | public UnmodifiableListAdapter(final List delegateList) { 39 | this.delegateList = Collections.unmodifiableList(delegateList); 40 | } 41 | 42 | @Override 43 | public E get(final int index) { 44 | return this.delegateList.get(index); 45 | } 46 | 47 | @Override 48 | public int indexOf(final Object o) { 49 | return this.delegateList.indexOf(o); 50 | } 51 | 52 | @Override 53 | public int lastIndexOf(final Object o) { 54 | return this.delegateList.lastIndexOf(o); 55 | } 56 | 57 | @Override 58 | public UnmodifiableList subList(final int fromIndex, final int toIndex) { 59 | return new UnmodifiableListAdapter<>(this.delegateList.subList(fromIndex, toIndex)); 60 | } 61 | 62 | @Override 63 | public int size() { 64 | return this.delegateList.size(); 65 | } 66 | 67 | @Override 68 | public boolean isEmpty() { 69 | return this.delegateList.isEmpty(); 70 | } 71 | 72 | @Override 73 | public boolean contains(final Object o) { 74 | return this.delegateList.contains(o); 75 | } 76 | 77 | @Override 78 | public Iterator iterator() { 79 | return this.delegateList.iterator(); 80 | } 81 | 82 | @Override 83 | public Object[] toArray() { 84 | return this.delegateList.toArray(); 85 | } 86 | 87 | @Override 88 | public T[] toArray(final T[] a) { 89 | return this.delegateList.toArray(a); 90 | } 91 | 92 | @Override 93 | public boolean containsAll(final Collection c) { 94 | return this.delegateList.containsAll(c); 95 | } 96 | 97 | public List toList() { 98 | return this.delegateList; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /runtime/src/main/java/com/kscs/util/jaxb/VetoableCollectionChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | package com.kscs.util.jaxb; 26 | 27 | import java.beans.PropertyVetoException; 28 | 29 | /** 30 | * ${PROJECT_NAME} 31 | * @author klemm0 32 | * 21/02/14 33 | * 34 | */ 35 | public interface VetoableCollectionChangeListener { 36 | void vetoableCollectionChange(final CollectionChangeEvent event) throws PropertyVetoException; 37 | } 38 | -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | org.apache.maven.skins 5 | maven-fluido-skin 6 | 2.0.0-M8 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 4.0.0 7 | 8 | jaxb2-rich-contract-plugin-test 9 | 10 | 11 | net.codesup.util 12 | jaxb-rich-contract-plugin-parent 13 | 4.2.1-SNAPSHOT 14 | 15 | 16 | JAXB XJC plugin test suite 17 | jar 18 | 19 | 20 | github 21 | 22 | 23 | 24 | scm:git:https://github.com/mklemm/jaxb2-rich-contract-plugin-test.git 25 | scm:git:https://github.com/mklemm/jaxb2-rich-contract-plugin-test.git 26 | https://github.com/mklemm/jaxb2-rich-contract-plugin-test.git 27 | HEAD 28 | 29 | 30 | 31 | 32 | org.assertj 33 | assertj-core 34 | 3.25.3 35 | 36 | 37 | 38 | 39 | 40 | 41 | org.jvnet.jaxb 42 | jaxb-maven-plugin 43 | 4.0.0 44 | 45 | true 46 | false 47 | 48 | -Xclone 49 | -Xfluent-builder 50 | -Xgroup-contract 51 | -group-contract.declareSetters=n 52 | -Ximmutable 53 | -Xmodifier 54 | -Xmeta 55 | -meta.extended=y 56 | -meta.camelCase=y 57 | 58 | 59 | 60 | net.codesup.util 61 | jaxb-rich-contract-plugin 62 | ${project.version} 63 | 64 | 65 | 66 | 67 | 68 | 69 | generate 70 | 71 | generate-sources 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /test/src/main/resources/XInclude.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | The XInclude definition is taken from the documentation at http://www.w3.org/TR/xinclude/ and is not directly 9 | provided by the W3C. 10 | The schema reflects the version 1.0. 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/src/main/resources/binding-config.xjb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/src/main/resources/math.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /test/src/main/resources/svg.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /test/src/test/java/com/kscs/jaxb2/contract/test/TouristTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * GNU General Public License 3 | * 4 | * Copyright (c) 2018 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | package com.kscs.jaxb2.contract.test; 20 | 21 | import java.util.Date; 22 | 23 | import org.junit.Test; 24 | 25 | public class TouristTest { 26 | @Test 27 | public void testDateUsage() { 28 | Tourist.builder().withAge(12).withDestination("home").withDepartureDate(new Date()).build(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/src/test/java/com/kscs/util/jaxb/BeanAssert.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2014 Klemm Software Consulting, Mirko Klemm 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | package com.kscs.util.jaxb; 25 | 26 | import java.util.List; 27 | import java.util.logging.Logger; 28 | 29 | import org.junit.Assert; 30 | 31 | @SuppressWarnings({"nls", "boxing"}) 32 | public class BeanAssert extends BeanDiff { 33 | private static final Logger LOGGER = Logger.getLogger(BeanAssert.class.getName()); 34 | 35 | public BeanAssert(final String packagePrefix, final String... ignoreNames) { 36 | super(packagePrefix, 19, 10, ignoreNames); 37 | } 38 | 39 | public BeanAssert(final String packagePrefix, final int decimalPrecision, final int decimalScale, final String... ignoreNames) { 40 | super(packagePrefix, decimalPrecision, decimalScale, ignoreNames); 41 | } 42 | 43 | public void assertPropertyEquality(final Object o1, final Object o2) { 44 | final List differences = findDifferences(o1, o2); 45 | final StringBuilder diffs1 = new StringBuilder(); 46 | for (final Difference diff : differences) { 47 | diffs1.append(" \t").append(diff.getPropertyName()).append(": expected=").append(diff.getExpected()).append(", actual=").append(diff.getActual()).append("\n"); 48 | BeanAssert.LOGGER.fine("Assertion Failure: " + diff.getPropertyName() + ": expected=" + diff.getExpected() + ", actual=" 49 | + diff.getActual()); 50 | } 51 | final String diffs = diffs1.toString(); 52 | Assert.assertTrue("differences:\n" + diffs, differences.isEmpty()); 53 | } 54 | 55 | 56 | } 57 | --------------------------------------------------------------------------------