Skip to content

Commit ced0131

Browse files
...
1 parent 3902a4b commit ced0131

37 files changed

+974
-1182
lines changed

.classpath

Lines changed: 0 additions & 9 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ npm-debug.log*
3333
bin/
3434
tmp/
3535
.metadata
36+
.classpath
3637
.settings
38+
.project
3739

3840
target/

.project

Lines changed: 0 additions & 23 deletions
This file was deleted.

SerialX-core/.classpath

Lines changed: 0 additions & 38 deletions
This file was deleted.

SerialX-core/.project

Lines changed: 0 additions & 23 deletions
This file was deleted.

SerialX-core/src/main/java/org/ugp/serialx/GenericScope.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.ugp.serialx;
22

3+
import static org.ugp.serialx.Utils.Instantiate;
4+
35
import java.io.Serializable;
46
import java.util.ArrayList;
57
import java.util.Arrays;
@@ -14,6 +16,7 @@
1416
import java.util.function.Function;
1517
import java.util.function.Predicate;
1618

19+
import org.ugp.serialx.Utils.NULL;
1720
import org.ugp.serialx.converters.ArrayConverter;
1821
import org.ugp.serialx.converters.DataParser;
1922
import org.ugp.serialx.protocols.SerializationProtocol;
@@ -146,7 +149,7 @@ public GenericScope<KeyT, ValT> clone()
146149
@SuppressWarnings("unchecked")
147150
public <S extends GenericScope<KeyT, ValT>> S clone(Class<S> typeOfClone) throws Exception
148151
{
149-
S clone = Serializer.Instantiate(typeOfClone);
152+
S clone = Instantiate(typeOfClone);
150153
clone.values = (List<ValT>) toValList();
151154
clone.variables = (Map<KeyT, ValT>) toVarMap();
152155
clone.parent = getParent();
@@ -167,7 +170,7 @@ public <S extends GenericScope<KeyT, ValT>> S clone(Class<S> typeOfClone) throws
167170
if (getClass() == newType)
168171
return (S) this;
169172

170-
GenericScope<Object, Object> clone = (GenericScope<Object, Object>) Serializer.Instantiate(newType);
173+
GenericScope<Object, Object> clone = (GenericScope<Object, Object>) Instantiate(newType);
171174
clone.values = (List<Object>) values();
172175
clone.variables = (Map<Object, Object>) variables();
173176
clone.parent = getParent();
@@ -275,7 +278,7 @@ public <V extends ValT> V get(KeyT variableKey, V defaultValue)
275278
V obj = (V) variables().get(variableKey);
276279
if (obj == null)
277280
return (V) defaultValue;
278-
return obj instanceof Serializer.NULL ? null : obj;
281+
return obj instanceof NULL ? null : obj;
279282
}
280283

281284
/**
@@ -317,7 +320,7 @@ public boolean containsIndependentValue(ValT value)
317320
public <V extends ValT> V get(int valueIndex)
318321
{
319322
V obj = (V) values().get(valueIndex < 0 ? valuesCount() + valueIndex : valueIndex);
320-
return obj instanceof Serializer.NULL ? null : obj;
323+
return obj instanceof NULL ? null : obj;
321324
}
322325

323326
/**
@@ -524,7 +527,7 @@ public <V> GenericScope<KeyT, V> transform(Function<ValT, V> trans, boolean incl
524527
try
525528
{
526529
Object obj = ent.getValue();
527-
obj = obj instanceof Serializer.NULL ? null : obj;
530+
obj = obj instanceof NULL ? null : obj;
528531
if (obj instanceof GenericScope && includeSubScopes)
529532
{
530533
GenericScope<?, V> sc = ((GenericScope<?, ValT>) obj).transform(trans, includeSubScopes);
@@ -539,7 +542,7 @@ else if ((obj = trans.apply((ValT) obj)) != DataParser.VOID)
539542

540543
try
541544
{
542-
GenericScope<KeyT, V> clone = Serializer.Instantiate(getClass());
545+
GenericScope<KeyT, V> clone = Instantiate(getClass());
543546
clone.values = fltVals;
544547
clone.variables = fltVars;
545548
clone.parent = getParent();
@@ -580,7 +583,7 @@ public <V> List<V> map(Function<ValT, V> trans, boolean includeSubScopes)
580583
for (Object obj : this)
581584
try
582585
{
583-
obj = obj instanceof Serializer.NULL ? null : obj;
586+
obj = obj instanceof NULL ? null : obj;
584587
if (obj instanceof GenericScope && includeSubScopes)
585588
{
586589
GenericScope<?, V> sc = ((GenericScope<?, ValT>) obj).transform(trans, includeSubScopes);

SerialX-core/src/main/java/org/ugp/serialx/JussSerializer.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package org.ugp.serialx;
22

3+
import static org.ugp.serialx.Utils.Clone;
4+
import static org.ugp.serialx.Utils.InvokeStaticFunc;
5+
import static org.ugp.serialx.Utils.indexOfNotInObj;
6+
import static org.ugp.serialx.Utils.multilpy;
37
import static org.ugp.serialx.converters.DataParser.VOID;
48

59
import java.beans.IntrospectionException;
@@ -21,6 +25,7 @@
2125
import java.util.Map;
2226
import java.util.Map.Entry;
2327

28+
import org.ugp.serialx.Utils.NULL;
2429
import org.ugp.serialx.converters.DataConverter;
2530
import org.ugp.serialx.converters.DataParser;
2631
import org.ugp.serialx.converters.DataParser.ParserRegistry;
@@ -38,6 +43,7 @@
3843
*
3944
* @since 1.3.2
4045
*/
46+
//TODO: Separate to SerialX-juss together with parsers and stuff
4147
@SuppressWarnings("serial")
4248
public class JussSerializer extends Serializer implements ImportsProvider
4349
{
@@ -483,7 +489,7 @@ else if (ch == '}' || ch == ']')
483489
else
484490
for (Map.Entry<?, ?> ent : parent.varEntrySet())
485491
if (variables().get(ent.getKey()) == ent.getValue())
486-
variables().remove(ent.getKey());
492+
variables().remove(ent.getKey());//TODO: Prevent neccesity of scope parent inheritance.
487493
return (S) this;
488494
}
489495

@@ -695,7 +701,7 @@ public <T> T cloneOf(String variableName , T defaultValue)
695701
T obj = get(variableName , defaultValue);
696702
if (obj == defaultValue)
697703
return defaultValue;
698-
return Serializer.Clone(obj, getParsers(), new Object[] {-99999, 0, this, getProtocols(), isGenerateComments()}, this, null, null, getProtocols());
704+
return Clone(obj, getParsers(), new Object[] {-99999, 0, this, getProtocols(), isGenerateComments()}, this, null, null, getProtocols());
699705
}
700706

701707
/**
@@ -711,7 +717,7 @@ public <T> T cloneOf(String variableName , T defaultValue)
711717
public <T> T cloneOf(int valueIndex)
712718
{
713719
T obj = get(valueIndex);
714-
return Serializer.Clone(obj, getParsers(), new Object[] {-99999, 0, this, getProtocols(), isGenerateComments()}, this, null, null, getProtocols());
720+
return Clone(obj, getParsers(), new Object[] {-99999, 0, this, getProtocols(), isGenerateComments()}, this, null, null, getProtocols());
715721
}
716722

717723
/**

SerialX-core/src/main/java/org/ugp/serialx/Scope.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.ugp.serialx;
22

3+
import static org.ugp.serialx.Utils.Instantiate;
34
import static org.ugp.serialx.converters.DataParser.VOID;
45

56
import java.beans.IntrospectionException;
@@ -1100,7 +1101,7 @@ public static <T> T intoNew(Class<T> objCls, GenericScope<String, ?> fromScope,
11001101
}
11011102
}
11021103

1103-
return into(Serializer.Instantiate(objCls), fromScope, fieldNamesToUse);
1104+
return into(Instantiate(objCls), fromScope, fieldNamesToUse);
11041105
}
11051106

11061107
/**

0 commit comments

Comments
 (0)