Skip to content

Commit 234b2fd

Browse files
further modularization and bug fixes
1 parent eded64b commit 234b2fd

40 files changed

+650
-438
lines changed

.classpath

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
4+
<attributes>
5+
<attribute name="maven.pomderived" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="output" path="target/classes"/>
9+
</classpath>

.project

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@
55
<projects>
66
</projects>
77
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
813
<buildCommand>
914
<name>org.eclipse.m2e.core.maven2Builder</name>
1015
<arguments>
1116
</arguments>
1217
</buildCommand>
1318
</buildSpec>
1419
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
1521
<nature>org.eclipse.m2e.core.maven2Nature</nature>
1622
</natures>
1723
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

.settings/org.eclipse.jdt.core.prefs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3+
org.eclipse.jdt.core.compiler.compliance=1.8
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.release=disabled
8+
org.eclipse.jdt.core.compiler.source=1.8

Changelog.md

Lines changed: 0 additions & 211 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/main/resources=UTF-8
4+
encoding//src/test/java=UTF-8
5+
encoding//src/test/resources=UTF-8
6+
encoding/<project>=UTF-8

SerialX-core/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
<parent>
44
<groupId>org.ugp</groupId>
55
<artifactId>serialx</artifactId>
6-
<version>1.3.7</version>
6+
<version>${revision}</version>
77
</parent>
8+
89
<groupId>org.ugp.serialx</groupId>
910
<artifactId>core</artifactId>
11+
<version>1.3.7</version>
1012

11-
<name>SerialX-core</name>
13+
<name>SerialX core</name>
1214
<description>Core of SerialX</description>
1315
</project>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public boolean containsIndependentValue(ValT value)
314314
* @since 1.2.0
315315
*/
316316
@SuppressWarnings("unchecked")
317-
public <V> V get(int valueIndex)
317+
public <V extends ValT> V get(int valueIndex)
318318
{
319319
V obj = (V) values().get(valueIndex < 0 ? valuesCount() + valueIndex : valueIndex);
320320
return obj instanceof Serializer.NULL ? null : obj;

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

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,11 @@
2525
import org.ugp.serialx.converters.DataParser;
2626
import org.ugp.serialx.converters.DataParser.ParserRegistry;
2727
import org.ugp.serialx.converters.ObjectConverter;
28-
import org.ugp.serialx.converters.StringConverter;
2928
import org.ugp.serialx.converters.imports.ImportConverter;
30-
import org.ugp.serialx.converters.operators.ArithmeticOperators;
31-
import org.ugp.serialx.converters.operators.ComparisonOperators;
32-
import org.ugp.serialx.converters.operators.ConditionalAssignmentOperators;
33-
import org.ugp.serialx.converters.operators.LogicalOperators;
29+
import org.ugp.serialx.converters.imports.ImportConverter.Imports;
30+
import org.ugp.serialx.converters.imports.ImportsProvider;
3431
import org.ugp.serialx.protocols.SerializationProtocol.ProtocolRegistry;
3532

36-
import javafx.beans.binding.When;
37-
3833
/**
3934
* This is implementation of {@link Serializer} for serializing in default SerialX API implementation known as JUSS (Java universal serial script) which is Json like domain specific language that has extended functionality!
4035
* It should generate and work with .juss or .srlx files!
@@ -44,17 +39,39 @@
4439
* @since 1.3.2
4540
*/
4641
@SuppressWarnings("serial")
47-
public class JussSerializer extends Serializer
42+
public class JussSerializer extends Serializer implements ImportsProvider
4843
{
49-
public static final ParserRegistry JUSS_PARSERS = DataParser.REGISTRY.clone(), JUSS_PARSERS_AND_OPERATORS;
44+
/**
45+
* {@link ParserRegistry} with all parsers required to parse JUSS!
46+
*
47+
* @since 1.3.2
48+
*/
49+
public static final ParserRegistry JUSS_PARSERS = DataParser.REGISTRY.clone();
50+
51+
/**
52+
* {@link ParserRegistry} with all parsers required to parse JUSS with additional operators.
53+
* <br>
54+
* Since 1.3.7 this requires "org.ugp.serialx.converters.Operators" from SerialX "operators" modules to be present on the classpath!
55+
*
56+
* @since 1.3.2
57+
*/
58+
public static final ParserRegistry JUSS_PARSERS_AND_OPERATORS;
5059

5160
static
5261
{
5362
JUSS_PARSERS.add(0, new ImportConverter());
5463
JUSS_PARSERS_AND_OPERATORS = JUSS_PARSERS.clone();
55-
JUSS_PARSERS_AND_OPERATORS.addAllBefore(StringConverter.class, true, new ConditionalAssignmentOperators(), new LogicalOperators(), new ComparisonOperators(), new ArithmeticOperators());
64+
65+
try
66+
{
67+
InvokeStaticFunc(Class.forName("org.ugp.serialx.converters.Operators"), "install", JUSS_PARSERS_AND_OPERATORS);
68+
}
69+
catch (Exception e)
70+
{}
5671
}
5772

73+
protected Imports imports;
74+
5875
/**
5976
* Set this on true and program will generate comments and report!<br>
6077
* Note: Keep this on false to achieve the best performance!
@@ -158,6 +175,14 @@ public ParserRegistry getParsers()
158175
return parsers != null ? parsers : (parsers = JUSS_PARSERS.clone());
159176
}
160177

178+
@Override
179+
public Imports getImports()
180+
{
181+
if (imports == null)
182+
imports = ImportConverter.IMPORTS.clone();
183+
return imports;
184+
}
185+
161186
/**
162187
* @param absoluteClone | If true this scope will be cloned using {@link Serializer#Clone(Object, Registry, Object[], Object...)}, if false {@link Scope#clone()}!
163188
*
@@ -785,7 +810,7 @@ <th>Obtained serializer content (return)</th>
785810
</tr>
786811
</table>
787812
*
788-
* @throws When something went wrong during deserialization!
813+
* @throws If something went wrong during deserialization!
789814
*
790815
* @since 1.3.5
791816
*/

0 commit comments

Comments
 (0)