the first commit

This commit is contained in:
2026-10-03 18:36:09 +05:30
parent c7377ec8da
commit 9a77807039
37 changed files with 1893 additions and 2 deletions
+9
View File
@@ -0,0 +1,9 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
indent_style = tab
indent_size = 4
+60
View File
@@ -0,0 +1,60 @@
## OS Generated
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Desktop.ini
## Eclipse IDE
.project
.classpath
.settings/
.metadata
bin/
*.tmp
*.bak
*.swp
local.properties
.externalToolBuilders/
*.launch
.pmd
.eclipse-pmd
# Intellij Idea
.idea
*.iml
# Maven
target/
# Gradle
.gradle/
build/
out/
## Project specific
deploy
# Default by github for Java projects
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Maven versionsBackup
*.versionsBackup
+2 -2
View File
@@ -1,3 +1,3 @@
# moe
# MOE: Mapping of Objects to External
A Java library to transfer state from external encoding formats (JSON, YAML) into Java data objects. And vice-versa.
Moe is a Java library to transfer state from external encoding formats (JSON, YAML) into Java data objects. And vice-versa.
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>daxi.moe</groupId>
<artifactId>daxi.moe.parent</artifactId>
<version>v1-SNAPSHOT</version>
</parent>
<artifactId>daxi.moe.json</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>daxi.moe</groupId>
<artifactId>daxi.moe.main</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
</project>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>daxi.moe</groupId>
<artifactId>daxi.moe.parent</artifactId>
<version>v1-SNAPSHOT</version>
</parent>
<artifactId>daxi.moe.main</artifactId>
<packaging>jar</packaging>
</project>
@@ -0,0 +1,39 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.app;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specifies the {@link Converter} implementation used to convert a field to and from
* {@link daxi.moe.model.AnyData}.
*
* @author indroneel
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ConvertUsing {
/**
* Returns the converter implementation to use for the annotated field.
*
* @return the converter class
*/
Class<? extends Converter> value();
}
@@ -0,0 +1,30 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.app;
import daxi.moe.model.AnyData;
import java.util.Optional;
/**
* @author indroneel
*/
public interface Converter {
<T> T decode(AnyData ad, Class<T> type);
Optional<AnyData> encode(Object obj);
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.app;
import daxi.moe.model.AnyData;
import java.io.InputStream;
/**
* Context for external data sources, such as a byte array or an inputstream. The data is loaded
* from these sources, and then converted into Java entities.
*
* @author indroneel
*/
public interface External {
External from(InputStream in);
External from(byte[] data);
boolean hasPath(String path);
AnyData getModel();
<T> T convert(Class<T> type);
<T> T convert(String path, Class<T> type);
}
@@ -0,0 +1,34 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.app;
import daxi.moe.model.AnyData;
import java.io.IOException;
/**
* @author indroneel
*/
public interface Internal {
Internal from(Object obj);
AnyData getModel();
byte[] convert() throws IOException;
byte[] convert(boolean pretty) throws IOException;
}
@@ -0,0 +1,32 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.app;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author indroneel
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface MapFrom {
String value();
}
@@ -0,0 +1,30 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.app;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author indroneel
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface MapTo {
}
@@ -0,0 +1,71 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.app;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author indroneel
*/
public abstract class Moe {
private static final Logger L = Logger.getLogger(Moe.class.getName());
protected abstract Moe options(Options... opts);
public abstract External external(String format);
public abstract Internal internal(String format);
public static Moe create() {
ServiceLoader<Moe> loader = ServiceLoader.load(Moe.class);
try {
java.util.Optional<Moe> moeopt = loader.findFirst();
if (moeopt.isEmpty()) {
if(L.isLoggable(Level.SEVERE)) {
L.log(Level.SEVERE, "moe implementation NOT found");
}
return null;
}
else {
Moe moe = moeopt.get();
if(L.isLoggable(Level.CONFIG)) {
L.config(String.format("moe implementation found: %s",
moe.getClass().getName()));
}
return moe;
}
}
catch (ServiceConfigurationError err) {
if(L.isLoggable(Level.SEVERE)) {
L.log(Level.SEVERE, "moe implementation NOT found", err);
}
return null;
}
}
public static Moe create(Options... opts) {
return Moe.create().options(opts);
}
public static enum Options {
ANYCASE,
DECODE_IGNORE_MISSING
}
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.codec;
/**
* Supplies the format identifier and format-specific codec components for a supported external data
* format.
*
* @author indroneel
*/
public interface MoeCodec {
/**
* Returns the identifier of the format supported by this provider (e.g., "JSON", "XML").
*
* @return the supported format identifier
*/
String getFormat();
/**
* Returns a decoder for the format supported by this provider.
*
* @return a decoder for the supported format
*/
MoeDecoder decoder();
/**
* Returns an encoder for the format supported by this provider.
*
* @return an encoder for the supported format
*/
MoeEncoder encoder();
}
@@ -0,0 +1,34 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.codec;
import daxi.moe.app.Moe;
import daxi.moe.model.AnyData;
import java.io.InputStream;
import java.util.List;
/**
* @author indroneel
*/
public interface MoeDecoder {
void setSource(byte[] data);
void setSource(InputStream input);
AnyData decode(List<Moe.Options> options);
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.codec;
import daxi.moe.model.AnyData;
/**
* Encodes data into the byte representation of a supported format.
*
* @author indroneel
*/
public interface MoeEncoder {
/**
* Encodes the supplied data using the default formatting.
*
* @param data the data to encode
* @return the encoded data as a byte array
*/
byte[] convert(AnyData data);
/**
* Encodes the supplied data, optionally formatting the output for readability.
*
* @param data the data to encode
* @param pretty whether to format the output for readability
* @return the encoded data as a byte array
*/
byte[] convert(AnyData data, boolean pretty);
}
@@ -0,0 +1,95 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package daxi.moe.lib;
import daxi.moe.app.External;
import daxi.moe.app.Moe;
import daxi.moe.codec.MoeCodec;
import daxi.moe.lib.m2j.M2JLinearImpl;
import daxi.moe.lib.m2j.M2JMappedImpl;
import daxi.moe.lib.m2j.M2JObjectImpl;
import daxi.moe.lib.m2j.M2JSimpleImpl;
import daxi.moe.lib.transform.M2JGlobals;
import daxi.moe.lib.transform.M2JLinear;
import daxi.moe.lib.transform.M2JMapped;
import daxi.moe.lib.transform.M2JObject;
import daxi.moe.lib.transform.M2JSimple;
import daxi.moe.model.AnyData;
import java.io.InputStream;
import java.util.List;
/**
* @author indroneel
*/
public class ExternalImpl implements External {
private final MoeCodec mprov;
private final List<Moe.Options> options;
private final M2JGlobals globals;
ExternalImpl(MoeCodec provider, List<Moe.Options> options) {
mprov = provider;
this.options = options;
globals = new M2JGlobals(options);
M2JSimple m2jSim = new M2JSimpleImpl(globals);
globals.setM2J(m2jSim);
M2JLinear m2jLin = new M2JLinearImpl(globals);
globals.setM2J(m2jLin);
M2JMapped m2jMap = new M2JMappedImpl(globals);
globals.setM2J(m2jMap);
M2JObject m2jObj = new M2JObjectImpl(globals);
globals.setM2J(m2jObj);
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Methods of interface External
@Override
public External from(InputStream in) {
return null;
}
@Override
public External from(byte[] data) {
return null;
}
@Override
public boolean hasPath(String path) {
return false;
}
@Override
public AnyData getModel() {
return null;
}
@Override
public <T> T convert(Class<T> type) {
return null;
}
@Override
public <T> T convert(String path, Class<T> type) {
return null;
}
}
@@ -0,0 +1,56 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package daxi.moe.lib;
import daxi.moe.app.Internal;
import daxi.moe.app.Moe;
import daxi.moe.codec.MoeCodec;
import daxi.moe.model.AnyData;
import java.io.IOException;
import java.util.List;
/**
*
* @author indroneel
*/
public class InternalImpl implements Internal {
InternalImpl(MoeCodec provider, List<Moe.Options> options) {
//TODO
}
@Override
public Internal from(Object obj) {
return null;
}
@Override
public AnyData getModel() {
return null;
}
@Override
public byte[] convert() throws IOException {
return new byte[0];
}
@Override
public byte[] convert(boolean pretty) throws IOException {
return new byte[0];
}
}
@@ -0,0 +1,78 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib;
import daxi.moe.app.External;
import daxi.moe.app.Internal;
import daxi.moe.app.Moe;
import daxi.moe.codec.MoeCodec;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author indroneel
*/
public class MoeImpl extends Moe {
private static final Logger L = Logger.getLogger(MoeImpl.class.getName());
private final static Map<String, MoeCodec> providers;
static {
if (L.isLoggable(Level.FINE)) {
L.fine("loading mapping providers");
}
providers = new HashMap<>();
ServiceLoader<MoeCodec> mpl = ServiceLoader.load(MoeCodec.class);
for (MoeCodec mp : mpl) {
String format = mp.getFormat();
providers.put(format.toLowerCase(), mp);
if (L.isLoggable(Level.FINE)) {
L.fine(String.format("%s -> %s", format, mp.getClass().getName()));
}
}
}
private List<Options> options;
protected MoeImpl() {
options = new ArrayList<>();
}
@Override
public External external(String format) {
MoeCodec mp = providers.get(format.toLowerCase());
if (mp != null) {
return new ExternalImpl(mp, options);
}
return null;
}
@Override
public Internal internal (String format) {
return null;
}
@Override
protected Moe options(Options... opts) {
if (opts != null && opts.length > 0) {
options = Arrays.asList(opts);
}
return this;
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.m2j;
import daxi.moe.lib.transform.M2JGlobals;
import daxi.moe.lib.transform.M2JLinear;
import daxi.moe.lib.transform.M2JStatus;
import daxi.moe.model.MappedData;
import java.lang.reflect.Method;
/**
* The only implementation of the {@link M2JLinear} interface.
*
* @author indroneel
*/
public class M2JLinearImpl implements M2JLinear {
private final M2JGlobals globals;
public M2JLinearImpl(M2JGlobals globals) {
this.globals = globals;
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Methods of interface M2JLinear
@Override
public M2JStatus convert(MappedData data, Object targetObj, Method targetMthd) {
return M2JStatus.NOT_VALID;
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.m2j;
import daxi.moe.lib.transform.M2JGlobals;
import daxi.moe.lib.transform.M2JMapped;
import daxi.moe.lib.transform.M2JStatus;
import daxi.moe.model.MappedData;
import java.lang.reflect.Method;
/**
* The only implementation of the {@link M2JMapped} interface.
*
* @author indroneel
*/
public class M2JMappedImpl implements M2JMapped {
private final M2JGlobals globals;
public M2JMappedImpl(M2JGlobals globals) {
this.globals = globals;
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Methods of interface M2JMapped
@Override
public M2JStatus convert(MappedData data, Object targetObj, Method targetMthd) {
return M2JStatus.NOT_VALID;
}
}
@@ -0,0 +1,206 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.m2j;
import daxi.moe.app.MapFrom;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Parameter;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
/**
* Contains information about a method on the target Java object. The method and the information
* can be used to transform some portions of internal data model and populate the containing object.
*
* @author indroneel
*/
public class M2JMethod {
private boolean valid = false;
private boolean setter = false;
private boolean linAdder = false;
private boolean mapAdder = false;
private String mapFromKey = null;
private Class<?> paramType = null;
/**
* Constructs the object around transforming method . The contained method may or may not be valid
* for transformation, depending on the method's signature and annotations.
*
* @param method the method to be encapsulated
*/
public M2JMethod(Method method) {
MapFrom mapFrom = method.getAnnotation(MapFrom.class);
if(mapFrom == null) {
// If the method does not have the @MapFrom annotation, it is not valid for
// transformation
return;
}
// populate the mapFromKey field with the value of the @MapFrom annotation
mapFromKey = mapFrom.value();
if(mapFromKey == null || mapFromKey.isBlank()) {
// If the @MapFrom annotation does not have a valid key, it is not valid for
// transformation
return;
}
int mod = method.getModifiers();
if(Modifier.isAbstract(mod) || Modifier.isStatic(mod) || !Modifier.isPrivate(mod)) {
// If the method is abstract, static, or not private, it is not valid for transformation
return;
}
if(method.getReturnType() != Void.TYPE) {
// If the method does not return void, it is not valid for transformation
return;
}
Parameter[] params = method.getParameters();
// Check if the method name starts with "_set" and has more than 4 characters
if(method.getName().startsWith("_set") && method.getName().length() > 4) {
if(params.length != 1) {
// If the method name starts with "_set" but does not have exactly one parameter, it
// is not valid for transformation
return;
}
Type type = params[0].getParameterizedType();
if(type instanceof TypeVariable<?> || type instanceof ParameterizedType) {
// If the parameter type is a type variable or a parameterized type, it is not valid
// for transformation
return;
}
paramType = params[0].getType();
if(paramType.isArray()) {
// If the parameter type is an array, it is not valid for transformation
return;
}
valid = true;
setter = true;
}
// Check if the method name starts with "_add" and has more than 4 characters
else if(method.getName().startsWith("_add") && method.getName().length() > 4) {
if(params.length ==1 ) {
Type type = params[0].getParameterizedType();
if(type instanceof TypeVariable<?> || type instanceof ParameterizedType) {
// If the parameter type is a type variable or a parameterized type, it is not
// valid for transformation
return;
}
paramType = params[0].getType();
if(paramType.isArray()) {
// If the parameter type is an array, it is not valid for transformation
return;
}
valid = true;
linAdder = true;
}
else if(params.length == 2) {
if(params[0].getType() != String.class) {
// If the first parameter type is not String, it is not valid for transformation
return;
}
Type type = params[1].getParameterizedType();
if(type instanceof TypeVariable<?> || type instanceof ParameterizedType) {
// If the second parameter type is a type variable or a parameterized type, it
// is not valid for transformation
return;
}
paramType = params[1].getType();
if(paramType.isArray()) {
// If the second parameter type is an array, it is not valid for transformation
return;
}
valid = true;
mapAdder = true;
}
}
}
/**
* Returns whether the method is valid for transformation.
*
* @return true if the method is valid for transformation, false otherwise.
*/
boolean isValid() {
return valid;
}
/**
* Returns whether the method is a setter. A setter is a method that takes a single parameter and
* sets it to the containing object.
*
* @return true if the method is a setter, false otherwise
*/
boolean isSetter() {
return setter;
}
/**
* Returns whether the method is a linear adder. A linear adder is a method that takes a single
* parameter and adds it to the containing object. The adder method is called multiple times, once
* for each value to be added.
*
* @return true if the method is a linear adder, false otherwise
*/
boolean isLinearAdder() {
return linAdder;
}
/**
* Returns whether the method is a mapped adder. A mapped adder is a method that takes two
* parameters, the first being a String key and the second being the value to be added. The library
* will use the key to determine which portion of the data model is mapped to the method. The adder
* method is called multiple times, once for each key-value pair to be added.
*
* @return true if the method is a mapped adder, false otherwise
*/
boolean isMappedAdder() {
return mapAdder;
}
/**
* Returns the key from the @MapFrom annotation. The library will use this key to determine which
* portion of the data model is mapped to the method.
*
* @return the key from the @MapFrom annotation
*/
String getMapFromKey() {
return mapFromKey;
}
/**
* Returns the parameter type of the method. The library will use this type to determine how to
* convert the data model item into the appropriate Java type.
*
* @return the parameter type of the method
*/
Class<?> getParamType() {
return paramType;
}
}
@@ -0,0 +1,139 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.m2j;
import daxi.moe.app.MapFrom;
import daxi.moe.lib.transform.M2JGlobals;
import daxi.moe.lib.transform.M2JLinear;
import daxi.moe.lib.transform.M2JMapped;
import daxi.moe.lib.transform.M2JObject;
import daxi.moe.lib.transform.M2JSimple;
import daxi.moe.lib.transform.M2JStatus;
import daxi.moe.model.MappedData;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* The only implementation of the {@link M2JObject} interface.
*
* @author indroneel
*/
public class M2JObjectImpl implements M2JObject {
private static final Logger L = Logger.getLogger(M2JObjectImpl.class.getName());
private final M2JGlobals globals;
public M2JObjectImpl(M2JGlobals globals) {
this.globals = globals;
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Methods of interface M2JObject
@Override
public M2JStatus convert(MappedData data, Object targetObj, Method targetMthd) {
return null;
}
@Override
public <T> T convert(MappedData data, Class<T> targetType) {
if(data == null || targetType == null) {
return null;
}
List<Method> methods = new LinkedList<>();
collateAllMethods(targetType, methods);
if(methods.isEmpty()) {
return null;
}
T target;
try {
Constructor<T> ctor = targetType.getConstructor();
target = ctor.newInstance();
}
catch(Exception exep) {
if(L.isLoggable(Level.WARNING)) {
L.log(Level.WARNING, exep.getMessage(), exep);
}
return null;
}
for(Method method : methods) {
M2JStatus m2jStat = transformImpl(data, target, method);
if(m2jStat == M2JStatus.ERROR) {
return null;
}
}
return target;
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Helper methods
private void collateAllMethods(Class<?> type, List<Method> methodList) {
if(type.getClassLoader() == null) {
// Skip system classes
return;
}
for (Method method : type.getDeclaredMethods()) {
if (!Modifier.isStatic(method.getModifiers())) {
MapFrom ann = method.getAnnotation(MapFrom.class);
if (ann != null && !ann.value().isBlank()) {
methodList.add(method);
}
}
}
if (type.getSuperclass() != null) {
collateAllMethods(type.getSuperclass(), methodList);
}
}
private M2JStatus transformImpl(MappedData data, Object targetObj, Method targetMthd) {
M2JSimple m2jSim = globals.getM2JSimple();
M2JStatus m2jStat = m2jSim.convert(data, targetObj, targetMthd);
if(m2jStat != M2JStatus.NOT_VALID) {
// here: m2jStat == M2JStatus.SUCCESS or m2jStat == M2JStatus.ERROR
return m2jStat;
}
M2JLinear m2jLin = globals.getM2JLinear();
m2jStat = m2jLin.convert(data, targetObj, targetMthd);
if(m2jStat != M2JStatus.NOT_VALID) {
// here: m2jStat == M2JStatus.SUCCESS or m2jStat == M2JStatus.ERROR
return m2jStat;
}
M2JMapped m2jMap = globals.getM2JMapped();
m2jStat = m2jMap.convert(data, targetObj, targetMthd);
if(m2jStat != M2JStatus.NOT_VALID) {
// here: m2jStat == M2JStatus.SUCCESS or m2jStat == M2JStatus.ERROR
return m2jStat;
}
// here: m2jStat == M2JStatus.NOT_VALID
return convert(data, targetObj, targetMthd);
}
}
@@ -0,0 +1,73 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.m2j;
import daxi.moe.lib.transform.M2JGlobals;
import daxi.moe.lib.transform.M2JSimple;
import daxi.moe.lib.transform.M2JStatus;
import daxi.moe.model.MappedData;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
/**
* The only implementation of the {@link daxi.moe.lib.transform.M2JSimple} interface.
*
* @author indroneel
*/
public class M2JSimpleImpl implements M2JSimple {
private final M2JGlobals globals;
public M2JSimpleImpl(M2JGlobals globals) {
this.globals = globals;
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Methods of interface M2JSimple
@Override
public M2JStatus convert(MappedData data, Object target, Method method) {
M2JMethod m2jMthd = new M2JMethod(method);
if(!m2jMthd.isValid() || !m2jMthd.isSetter()) {
return M2JStatus.NOT_VALID;
}
Class<?> paramType = m2jMthd.getParamType();
if(!isSupportedParamType(paramType)) {
return M2JStatus.NOT_VALID;
}
return M2JStatus.SUCCESS;
}
private boolean isSupportedParamType(Class<?> paramType) {
return paramType == String.class
|| paramType == BigInteger.class
|| paramType == BigDecimal.class
|| Number.class.isAssignableFrom(paramType)
|| paramType == byte.class
|| paramType == short.class
|| paramType == int.class
|| paramType == long.class
|| paramType == float.class
|| paramType == double.class
|| paramType == boolean.class
|| paramType == Boolean.class;
}
}
@@ -0,0 +1,76 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.transform;
import daxi.moe.app.Moe;
import java.util.List;
/**
* A registry for model-to-Java transformers as singletons. It also stores options that were set
* during instatiation of MOE.
*
* @author indroneel
*/
public class M2JGlobals {
private final List<Moe.Options> options;
private M2JSimple simM2j;
private M2JLinear linM2j;
private M2JMapped mapM2j;
private M2JObject objM2j;
public M2JGlobals(List<Moe.Options> options) {
this.options = options;
}
public void setM2J(M2JSimple m2j) {
simM2j = m2j;
}
public void setM2J(M2JLinear m2j) {
linM2j = m2j;
}
public void setM2J(M2JMapped m2j) {
mapM2j = m2j;
}
public void setM2J(M2JObject m2j) {
objM2j = m2j;
}
public boolean hasOption(Moe.Options opt) {
return options.contains(opt);
}
public M2JSimple getM2JSimple() {
return simM2j;
}
public M2JLinear getM2JLinear() {
return linM2j;
}
public M2JMapped getM2JMapped() {
return mapM2j;
}
public M2JObject getM2JObject() {
return objM2j;
}
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.transform;
import daxi.moe.model.MappedData;
import java.lang.reflect.Method;
/**
* Defines a marker interface for classes that can be used to populate portions of a Java object
* with {@link daxi.moe.model.LinearData}.
*
* @author indroneel
*/
public interface M2JLinear {
/**
* Converts a linear data from the given mapped data into the target object using the specified
* method.
*
* @param data The mapped data that contains the linear data to convert.
* @param targetObj The target object to populate with the converted data.
* @param targetMthd The method to use for populating the target object.
* @return The status of the conversion.
*/
M2JStatus convert(MappedData data, Object targetObj, Method targetMthd);
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.transform;
import daxi.moe.model.MappedData;
import java.lang.reflect.Method;
/**
* Defines a marker interface for classes that can be used to populate portions of a Java object
* with {@link daxi.moe.model.MappedData}.
*
* @author indroneel
*/
public interface M2JMapped {
/**
* Converts a nested mapped data contained within a given mapped data into the target object using
* the specified method.
*
* @param data The mapped data that contains the nested mapped data to convert.
* @param targetObj The target object to populate with the converted data.
* @param targetMthd The method to use for populating the target object.
* @return The status of the conversion.
*/
M2JStatus convert(MappedData data, Object targetObj, Method targetMthd);
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.transform;
import daxi.moe.model.MappedData;
import java.lang.reflect.Method;
/**
* Defines a marker interface for classes that can be used to convert from
* {@link daxi.moe.model.MappedData} to a Java object.
*
* @author indroneel
*/
public interface M2JObject {
/**
* Populates a Java object with data from a {@link MappedData} instance using the specified method.
* @param data the {@link MappedData} instance containing the data to populate the Java object
* @param targetObj the Java object to populate
* @param targetMthd the method to use for populating the Java object
* @return the status of the operation
*/
M2JStatus convert(MappedData data, Object targetObj, Method targetMthd);
/**
* Constructs a Java object of the specified type from the given {@link MappedData} instance.
* @param data the {@link MappedData} instance containing the data to populate the Java object
* @param targetType the class of the Java object to construct
* @param <T> the type of the Java object to construct
* @return the constructed Java object of the specified type
*/
<T> T convert(MappedData data, Class<T> targetType);
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.transform;
import daxi.moe.model.MappedData;
import java.lang.reflect.Method;
/**
* Defines a marker interface for classes that can be used to populate portions of a Java object
* with {@link daxi.moe.model.SimpleData}.
*
* @author indroneel
*/
public interface M2JSimple {
/**
* Converts a linear data from the given mapped data into the target object using the specified
* method.
*
* @param data the mapped data that contains the simple data to convert
* @param targetObj the object to populate
* @param targetMthd the method to invoke on the target object to set the value
* @return The status of the conversion.
*/
M2JStatus convert(MappedData data, Object targetObj, Method targetMthd);
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.lib.transform;
/**
* Defines the possible statuses for a transformation. The transformation can be from the model data
* to Java objects or vice versa.
*
* @author indroneel
*/
public enum M2JStatus {
NOT_VALID,
SUCCESS,
ERROR
}
@@ -0,0 +1,56 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.model;
/**
* @author indroneel
*/
public class AnyData {
private final SimpleData simple;
private final LinearData linear;
private final MappedData mapped;
public AnyData(SimpleData simple) {
this.simple = simple;
this.linear = null;
this.mapped = null;
}
public AnyData(LinearData linear) {
this.simple = null;
this.linear = linear;
this.mapped = null;
}
public AnyData(MappedData mapped) {
this.simple = null;
this.linear = null;
this.mapped = mapped;
}
public SimpleData asSimple() {
return simple;
}
public LinearData asLinear() {
return linear;
}
public MappedData asMapped() {
return mapped;
}
}
@@ -0,0 +1,43 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.model;
import java.util.LinkedList;
import java.util.List;
/**
* @author indroneel
*/
public class LinearData {
private final List<AnyData> dataList;
public LinearData() {
dataList = new LinkedList<>();
}
public void add(AnyData value) {
dataList.add(value);
}
public AnyData get(int position) {
return dataList.get(position);
}
public int size() {
return dataList.size();
}
}
@@ -0,0 +1,48 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.model;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author indroneel
*/
public class MappedData {
private final Map<String, AnyData> dataMap;
public MappedData() {
dataMap = new HashMap<>();
}
public List<String> getKeys() {
return dataMap.keySet().stream().toList();
}
public boolean contains(String key) {
return dataMap.containsKey(key);
}
public AnyData get(String key) {
return dataMap.get(key);
}
public void put(String key, AnyData value) {
dataMap.put(key, value);
}
}
@@ -0,0 +1,56 @@
/*
* Copyright (c) DuxTechnica
*
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
* use this file except in compliance with the License. You may obtain a copy of the License by
* contacting:
*
* Dux Technica, [email protected]
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package daxi.moe.model;
/**
* @author indroneel
*/
public class SimpleData {
private final String strVal;
private final Number numVal;
private final Boolean boolVal;
public SimpleData(String value) {
strVal = value;
numVal = null;
boolVal = null;
}
public SimpleData(Number value) {
strVal = null;
numVal = value;
boolVal = null;
}
public SimpleData(Boolean value) {
strVal = null;
numVal = null;
boolVal = value;
}
public String getString() {
return strVal;
}
public Boolean getBoolean() {
return boolVal;
}
public Number getNumber() {
return numVal;
}
}
@@ -0,0 +1,15 @@
#
# Copyright (c) DuxTechnica
#
# Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
# use this file except in compliance with the License. You may obtain a copy of the License by
# contacting:
#
# Dux Technica, [email protected]
#
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language governing permissions and
# limitations under the License.
#
daxi.moe.lib.MoeImpl
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>daxi.moe</groupId>
<artifactId>daxi.moe.parent</artifactId>
<version>v1-SNAPSHOT</version>
</parent>
<artifactId>daxi.moe.toml</artifactId>
<packaging>jar</packaging>
<properties>
<dep.tomlj.version>1.0.0</dep.tomlj.version>
</properties>
<dependencies>
<dependency>
<groupId>daxi.moe</groupId>
<artifactId>daxi.moe.app</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.tomlj</groupId>
<artifactId>tomlj</artifactId>
<version>${dep.tomlj.version}</version>
</dependency>
</dependencies>
</project>
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>daxi.moe</groupId>
<artifactId>daxi.moe.parent</artifactId>
<version>v1-SNAPSHOT</version>
</parent>
<artifactId>daxi.moe.yaml</artifactId>
<packaging>jar</packaging>
<properties>
<dep.snakeyaml.version>2.4</dep.snakeyaml.version>
</properties>
<dependencies>
<dependency>
<groupId>daxi.moe</groupId>
<artifactId>daxi.moe.app</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${dep.snakeyaml.version}</version>
</dependency>
</dependencies>
</project>
+90
View File
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>daxi.moe</groupId>
<artifactId>daxi.moe.parent</artifactId>
<name>moe</name>
<description>Library to transfer state from external encoding formats (JSON, YAML) into Java data objects.</description>
<packaging>pom</packaging>
<version>v1-SNAPSHOT</version>
<properties>
<plugin.compiler.version>3.12.1</plugin.compiler.version>
<plugin.javadoc.version>3.6.3</plugin.javadoc.version>
<plugin.source.version>3.3.0</plugin.source.version>
<plugin.release.version>3.1.1</plugin.release.version>
<plugin.deploy.version>3.1.1</plugin.deploy.version>
<target.java.version>25</target.java.version>
</properties>
<modules>
<module>moe-main</module>
<module>moe-json</module>
<module>moe-yaml</module>
<module>moe-toml</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.compiler.version}</version>
<configuration>
<release>${target.java.version}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${plugin.javadoc.version}</version>
<executions>
<execution>
<id>javadoc</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${plugin.source.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${plugin.release.version}</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${plugin.deploy.version}</version>
</plugin>
</plugins>
</build>
</project>