intermediate checkin
This commit is contained in:
@@ -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.app;
|
||||
|
||||
public class DecodeException extends Exception {
|
||||
|
||||
private final String type;
|
||||
private final String method;
|
||||
|
||||
public DecodeException(String typeName, String methodName, String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.type = typeName;
|
||||
this.method = methodName;
|
||||
}
|
||||
|
||||
public DecodeException(String message, Throwable cause) {
|
||||
this(null, null, message, cause);
|
||||
}
|
||||
|
||||
public DecodeException(Throwable cause) {
|
||||
this(null, null, null, cause);
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
}
|
||||
@@ -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.codec.mem;
|
||||
|
||||
import daxi.moe.codec.MoeCodec;
|
||||
import daxi.moe.codec.MoeDecoder;
|
||||
import daxi.moe.codec.MoeEncoder;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
public class MemCodec implements MoeCodec {
|
||||
|
||||
@Override
|
||||
public String getFormat() {
|
||||
return "mem";
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoeDecoder decoder() {
|
||||
return new MemDecoder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoeEncoder encoder() {
|
||||
return new MemEncoder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.mem;
|
||||
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.codec.MoeDecoder;
|
||||
import daxi.moe.model.AnyData;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
public class MemDecoder implements MoeDecoder {
|
||||
|
||||
@Override
|
||||
public void setSource(byte[] data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSource(InputStream input) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnyData decode(List<Moe.Options> options) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.mem;
|
||||
|
||||
import daxi.moe.codec.MoeEncoder;
|
||||
import daxi.moe.model.AnyData;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
*/
|
||||
|
||||
public class MemEncoder implements MoeEncoder {
|
||||
|
||||
@Override
|
||||
public byte[] convert(AnyData data) {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] convert(AnyData data, boolean pretty) {
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ package daxi.moe.lib;
|
||||
import daxi.moe.app.External;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.codec.MoeCodec;
|
||||
import daxi.moe.codec.MoeDecoder;
|
||||
import daxi.moe.lib.m2j.M2JLinearImpl;
|
||||
import daxi.moe.lib.m2j.M2JMappedImpl;
|
||||
import daxi.moe.lib.m2j.M2JObjectImpl;
|
||||
@@ -28,9 +29,12 @@ import daxi.moe.lib.transform.M2JMapped;
|
||||
import daxi.moe.lib.transform.M2JObject;
|
||||
import daxi.moe.lib.transform.M2JSimple;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author indroneel
|
||||
@@ -38,26 +42,29 @@ import java.util.List;
|
||||
|
||||
public class ExternalImpl implements External {
|
||||
|
||||
private final MoeCodec mprov;
|
||||
private static final Logger L = Logger.getLogger(ExternalImpl.class.getName());
|
||||
|
||||
private final MoeDecoder decoder;
|
||||
private final List<Moe.Options> options;
|
||||
private final M2JGlobals globals;
|
||||
private AnyData model;
|
||||
|
||||
ExternalImpl(MoeCodec codec, List<Moe.Options> options) {
|
||||
decoder = codec.decoder();
|
||||
|
||||
ExternalImpl(MoeCodec provider, List<Moe.Options> options) {
|
||||
mprov = provider;
|
||||
this.options = options;
|
||||
globals = new M2JGlobals(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);
|
||||
|
||||
model = new AnyData(new MappedData());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -65,12 +72,22 @@ public class ExternalImpl implements External {
|
||||
|
||||
@Override
|
||||
public External from(InputStream in) {
|
||||
return null;
|
||||
decoder.setSource(in);
|
||||
model = decoder.decode(options);
|
||||
if(model == null) {
|
||||
model = new AnyData(new MappedData());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public External from(byte[] data) {
|
||||
return null;
|
||||
decoder.setSource(data);
|
||||
model = decoder.decode(options);
|
||||
if(model == null) {
|
||||
model = new AnyData(new MappedData());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,12 +97,19 @@ public class ExternalImpl implements External {
|
||||
|
||||
@Override
|
||||
public AnyData getModel() {
|
||||
return null;
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T convert(Class<T> type) {
|
||||
return null;
|
||||
MappedData data = model.asMapped();
|
||||
if(data == null) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("input data model does not contain MappedData as root element");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return globals.getM2JObject().convert(data, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,10 +18,13 @@ package daxi.moe.lib;
|
||||
import daxi.moe.app.Internal;
|
||||
import daxi.moe.app.Moe;
|
||||
import daxi.moe.codec.MoeCodec;
|
||||
import daxi.moe.codec.MoeEncoder;
|
||||
import daxi.moe.model.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,18 +33,32 @@ import java.util.List;
|
||||
|
||||
public class InternalImpl implements Internal {
|
||||
|
||||
private static final Logger L = Logger.getLogger(InternalImpl.class.getName());
|
||||
|
||||
private final MoeEncoder encoder;
|
||||
private final List<Moe.Options> options;
|
||||
|
||||
//private final M2JGlobals globals;
|
||||
|
||||
private AnyData model;
|
||||
|
||||
InternalImpl(MoeCodec provider, List<Moe.Options> options) {
|
||||
//TODO
|
||||
encoder = provider.encoder();
|
||||
this.options = options;
|
||||
|
||||
//globals = new M2JGlobals(options);
|
||||
|
||||
model = new AnyData(new MappedData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Internal from(Object obj) {
|
||||
return null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnyData getModel() {
|
||||
return null;
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,32 +31,32 @@ public class MoeImpl extends Moe {
|
||||
|
||||
private static final Logger L = Logger.getLogger(MoeImpl.class.getName());
|
||||
|
||||
private final static Map<String, MoeCodec> providers;
|
||||
private final static Map<String, MoeCodec> codecs;
|
||||
|
||||
static {
|
||||
if (L.isLoggable(Level.FINE)) {
|
||||
L.fine("loading mapping providers");
|
||||
L.fine("loading MOE codecs");
|
||||
}
|
||||
providers = new HashMap<>();
|
||||
ServiceLoader<MoeCodec> mpl = ServiceLoader.load(MoeCodec.class);
|
||||
for (MoeCodec mp : mpl) {
|
||||
String format = mp.getFormat();
|
||||
providers.put(format.toLowerCase(), mp);
|
||||
codecs = new HashMap<>();
|
||||
ServiceLoader<MoeCodec> codecs = ServiceLoader.load(MoeCodec.class);
|
||||
for (MoeCodec codec : codecs) {
|
||||
String format = codec.getFormat();
|
||||
MoeImpl.codecs.put(format.toLowerCase(), codec);
|
||||
if (L.isLoggable(Level.FINE)) {
|
||||
L.fine(String.format("%s -> %s", format, mp.getClass().getName()));
|
||||
L.fine(String.format("%s -> %s", format, codec.getClass().getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Options> options;
|
||||
|
||||
protected MoeImpl() {
|
||||
public MoeImpl() {
|
||||
options = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public External external(String format) {
|
||||
MoeCodec mp = providers.get(format.toLowerCase());
|
||||
MoeCodec mp = codecs.get(format.toLowerCase());
|
||||
if (mp != null) {
|
||||
return new ExternalImpl(mp, options);
|
||||
}
|
||||
@@ -65,6 +65,10 @@ public class MoeImpl extends Moe {
|
||||
|
||||
@Override
|
||||
public Internal internal (String format) {
|
||||
MoeCodec mp = codecs.get(format.toLowerCase());
|
||||
if (mp != null) {
|
||||
return new InternalImpl(mp, options);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,11 +58,17 @@ public class M2JObjectImpl implements M2JObject {
|
||||
@Override
|
||||
public <T> T convert(MappedData data, Class<T> targetType) {
|
||||
if(data == null || targetType == null) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Invalid arguments: data=" + data + ", targetType=" + targetType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
List<Method> methods = new LinkedList<>();
|
||||
collateAllMethods(targetType, methods);
|
||||
if(methods.isEmpty()) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("No suitable methods found in targetType: " + targetType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,16 @@ 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.AnyData;
|
||||
import daxi.moe.model.MappedData;
|
||||
import daxi.moe.model.SimpleData;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* The only implementation of the {@link daxi.moe.lib.transform.M2JSimple} interface.
|
||||
@@ -31,6 +36,8 @@ import java.math.BigInteger;
|
||||
|
||||
public class M2JSimpleImpl implements M2JSimple {
|
||||
|
||||
private static final Logger L = Logger.getLogger(M2JSimpleImpl.class.getName());
|
||||
|
||||
private final M2JGlobals globals;
|
||||
|
||||
public M2JSimpleImpl(M2JGlobals globals) {
|
||||
@@ -53,9 +60,71 @@ public class M2JSimpleImpl implements M2JSimple {
|
||||
return M2JStatus.NOT_VALID;
|
||||
}
|
||||
|
||||
String key = m2jMthd.getMapFromKey();
|
||||
if(!data.contains(key)) {
|
||||
return M2JStatus.NOT_VALID;
|
||||
}
|
||||
|
||||
AnyData adata = data.get(key);
|
||||
SimpleData sdata = adata.asSimple();
|
||||
if(sdata == null) {
|
||||
return M2JStatus.NOT_VALID;
|
||||
}
|
||||
|
||||
Object paramVal = null;
|
||||
|
||||
if(paramType == String.class) {
|
||||
paramVal = sdata.getString();
|
||||
}
|
||||
else if(paramType == BigInteger.class) {
|
||||
paramVal = getBigIntegerValue(sdata);
|
||||
}
|
||||
else if(paramType == BigDecimal.class) {
|
||||
paramVal = getBigDecimalValue(sdata);
|
||||
}
|
||||
else if(paramType == byte.class || paramType == Byte.class) {
|
||||
paramVal = getByteValue(sdata);
|
||||
}
|
||||
else if(paramType == short.class || paramType == Short.class) {
|
||||
paramVal = getShortValue(sdata);
|
||||
}
|
||||
else if(paramType == int.class || paramType == Integer.class) {
|
||||
paramVal = getIntegerValue(sdata);
|
||||
}
|
||||
else if(paramType == long.class || paramType == Long.class) {
|
||||
paramVal = getLongValue(sdata);
|
||||
}
|
||||
else if(paramType == float.class || paramType == Float.class) {
|
||||
paramVal = getFloatValue(sdata);
|
||||
}
|
||||
else if(paramType == double.class || paramType == Double.class) {
|
||||
paramVal = getDoubleValue(sdata);
|
||||
}
|
||||
else if(paramType == boolean.class || paramType == Boolean.class) {
|
||||
paramVal = getBooleanValue(sdata);
|
||||
}
|
||||
|
||||
if(paramVal == null) {
|
||||
return M2JStatus.NOT_VALID;
|
||||
}
|
||||
|
||||
try {
|
||||
method.setAccessible(true);
|
||||
method.invoke(target, paramVal);
|
||||
method.setAccessible(false);
|
||||
}
|
||||
catch (ReflectiveOperationException exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.log(Level.WARNING, exep.getMessage(), exep);
|
||||
}
|
||||
return M2JStatus.ERROR;
|
||||
}
|
||||
return M2JStatus.SUCCESS;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper methods
|
||||
|
||||
private boolean isSupportedParamType(Class<?> paramType) {
|
||||
return paramType == String.class
|
||||
|| paramType == BigInteger.class
|
||||
@@ -70,4 +139,199 @@ public class M2JSimpleImpl implements M2JSimple {
|
||||
|| paramType == boolean.class
|
||||
|| paramType == Boolean.class;
|
||||
}
|
||||
|
||||
private BigInteger getBigIntegerValue(SimpleData data) {
|
||||
BigInteger paramVal = null;
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = new BigInteger(Long.toString(nval.longValue()));
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
try {
|
||||
paramVal = new BigInteger(sval);
|
||||
}
|
||||
catch(Exception exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Unable to convert string [" + sval + "] to BigInteger");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
private BigDecimal getBigDecimalValue(SimpleData data) {
|
||||
BigDecimal paramVal = null;
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = new BigDecimal(nval.toString());
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
try {
|
||||
paramVal = new BigDecimal(sval);
|
||||
}
|
||||
catch(Exception exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Unable to convert string [" + sval + "] to BigDecimal");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
private Byte getByteValue(SimpleData data) {
|
||||
Byte paramVal = null;
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = nval.byteValue();
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
try {
|
||||
paramVal = Byte.parseByte(sval);
|
||||
}
|
||||
catch(NumberFormatException exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Unable to convert string [" + sval + "] to byte");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
private Short getShortValue(SimpleData data) {
|
||||
Short paramVal = null;
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = nval.shortValue();
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
try {
|
||||
paramVal = Short.parseShort(sval);
|
||||
}
|
||||
catch(NumberFormatException exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Unable to convert string [" + sval + "] to short");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
private Integer getIntegerValue(SimpleData data) {
|
||||
Integer paramVal = null;
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = nval.intValue();
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
try {
|
||||
paramVal = Integer.parseInt(sval);
|
||||
}
|
||||
catch(NumberFormatException exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Unable to convert string [" + sval + "] to integer");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
private Long getLongValue(SimpleData data) {
|
||||
Long paramVal = null;
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = nval.longValue();
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
try {
|
||||
paramVal = Long.parseLong(sval);
|
||||
}
|
||||
catch(NumberFormatException exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Unable to convert string [" + sval + "] to long");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
private Float getFloatValue(SimpleData data) {
|
||||
Float paramVal = null;
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = nval.floatValue();
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
try {
|
||||
paramVal = Float.parseFloat(sval);
|
||||
}
|
||||
catch(NumberFormatException exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Unable to convert string [" + sval + "] to float");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
private Double getDoubleValue(SimpleData data) {
|
||||
Double paramVal = null;
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = nval.doubleValue();
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
try {
|
||||
paramVal = Double.parseDouble(sval);
|
||||
}
|
||||
catch(NumberFormatException exep) {
|
||||
if(L.isLoggable(Level.WARNING)) {
|
||||
L.warning("Unable to convert string [" + sval + "] to double");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
private Boolean getBooleanValue(SimpleData data) {
|
||||
Boolean paramVal = data.getBoolean();
|
||||
if(paramVal != null) {
|
||||
return paramVal;
|
||||
}
|
||||
|
||||
Number nval = data.getNumber();
|
||||
if(nval != null) {
|
||||
paramVal = nval.intValue() != 0;
|
||||
}
|
||||
else {
|
||||
String sval = data.getString();
|
||||
if(sval != null) {
|
||||
paramVal = Boolean.parseBoolean(sval.toLowerCase(Locale.getDefault()));
|
||||
}
|
||||
}
|
||||
return paramVal;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.codec.mem.MemCodec
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>daxi.moe</groupId>
|
||||
<artifactId>daxi.moe.app</artifactId>
|
||||
<artifactId>daxi.moe.main</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>daxi.moe</groupId>
|
||||
<artifactId>daxi.moe.app</artifactId>
|
||||
<artifactId>daxi.moe.main</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
Reference in New Issue
Block a user