diff --git a/pom.xml b/pom.xml
index 7a21810..eb21e58 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
jar
globs
Generic Lightweight ObjectS
- 3.3-SNAPSHOT
+ 4.0-SNAPSHOT
UTF-8
@@ -108,15 +108,21 @@
org.globsframework
saxstack
- 3.3-SNAPSHOT
+ 4.0-SNAPSHOT
+ test
+
+
+
+
+
+
+
+
+ org.ow2.asm
+ asm
+ 9.4
test
-
-
-
-
-
-
xerces
xercesImpl
diff --git a/src/main/java/org/globsframework/functional/FunctionalKeyBuilder.java b/src/main/java/org/globsframework/functional/FunctionalKeyBuilder.java
index 71dfca7..8e65d67 100644
--- a/src/main/java/org/globsframework/functional/FunctionalKeyBuilder.java
+++ b/src/main/java/org/globsframework/functional/FunctionalKeyBuilder.java
@@ -1,6 +1,6 @@
package org.globsframework.functional;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValues;
diff --git a/src/main/java/org/globsframework/functional/FunctionalKeyBuilderFactory.java b/src/main/java/org/globsframework/functional/FunctionalKeyBuilderFactory.java
index f0799dd..28e653b 100644
--- a/src/main/java/org/globsframework/functional/FunctionalKeyBuilderFactory.java
+++ b/src/main/java/org/globsframework/functional/FunctionalKeyBuilderFactory.java
@@ -1,7 +1,7 @@
package org.globsframework.functional;
import org.globsframework.functional.impl.DefaultFunctionalKeyBuilderFactory;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
public interface FunctionalKeyBuilderFactory {
diff --git a/src/main/java/org/globsframework/functional/impl/AbstractFieldValue.java b/src/main/java/org/globsframework/functional/impl/AbstractFieldValue.java
index db7798f..e638e31 100644
--- a/src/main/java/org/globsframework/functional/impl/AbstractFieldValue.java
+++ b/src/main/java/org/globsframework/functional/impl/AbstractFieldValue.java
@@ -1,6 +1,6 @@
package org.globsframework.functional.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.FieldSetter;
import org.globsframework.model.FieldValues;
diff --git a/src/main/java/org/globsframework/functional/impl/DefaultFunctionalKeyBuilderFactory.java b/src/main/java/org/globsframework/functional/impl/DefaultFunctionalKeyBuilderFactory.java
index 36e890d..9dc92c1 100644
--- a/src/main/java/org/globsframework/functional/impl/DefaultFunctionalKeyBuilderFactory.java
+++ b/src/main/java/org/globsframework/functional/impl/DefaultFunctionalKeyBuilderFactory.java
@@ -2,7 +2,7 @@
import org.globsframework.functional.FunctionalKeyBuilder;
import org.globsframework.functional.FunctionalKeyBuilderFactory;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import java.util.ArrayList;
diff --git a/src/main/java/org/globsframework/functional/impl/ManyFieldsMutableKey.java b/src/main/java/org/globsframework/functional/impl/ManyFieldsMutableKey.java
index f8e392a..c78dcea 100644
--- a/src/main/java/org/globsframework/functional/impl/ManyFieldsMutableKey.java
+++ b/src/main/java/org/globsframework/functional/impl/ManyFieldsMutableKey.java
@@ -3,7 +3,7 @@
import org.globsframework.functional.FunctionalKey;
import org.globsframework.functional.FunctionalKeyBuilder;
import org.globsframework.functional.MutableFunctionalKey;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValue;
import org.globsframework.model.FieldValues;
diff --git a/src/main/java/org/globsframework/functional/impl/ManyFunctionalKeyBuilder.java b/src/main/java/org/globsframework/functional/impl/ManyFunctionalKeyBuilder.java
index f3a4ada..dcf9fd7 100644
--- a/src/main/java/org/globsframework/functional/impl/ManyFunctionalKeyBuilder.java
+++ b/src/main/java/org/globsframework/functional/impl/ManyFunctionalKeyBuilder.java
@@ -3,7 +3,7 @@
import org.globsframework.functional.FunctionalKey;
import org.globsframework.functional.FunctionalKeyBuilder;
import org.globsframework.functional.MutableFunctionalKey;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValues;
diff --git a/src/main/java/org/globsframework/functional/impl/OneFieldMutableKey.java b/src/main/java/org/globsframework/functional/impl/OneFieldMutableKey.java
index 81014e5..76f81c4 100644
--- a/src/main/java/org/globsframework/functional/impl/OneFieldMutableKey.java
+++ b/src/main/java/org/globsframework/functional/impl/OneFieldMutableKey.java
@@ -3,7 +3,7 @@
import org.globsframework.functional.FunctionalKey;
import org.globsframework.functional.FunctionalKeyBuilder;
import org.globsframework.functional.MutableFunctionalKey;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValue;
import org.globsframework.utils.exceptions.ItemNotFound;
diff --git a/src/main/java/org/globsframework/functional/impl/OneFunctionalKeyBuilder.java b/src/main/java/org/globsframework/functional/impl/OneFunctionalKeyBuilder.java
index 1216c3d..db027c6 100644
--- a/src/main/java/org/globsframework/functional/impl/OneFunctionalKeyBuilder.java
+++ b/src/main/java/org/globsframework/functional/impl/OneFunctionalKeyBuilder.java
@@ -3,7 +3,7 @@
import org.globsframework.functional.FunctionalKey;
import org.globsframework.functional.FunctionalKeyBuilder;
import org.globsframework.functional.MutableFunctionalKey;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValues;
diff --git a/src/main/java/org/globsframework/functional/impl/TwoFieldsMutableKey.java b/src/main/java/org/globsframework/functional/impl/TwoFieldsMutableKey.java
index cb8298a..dcf51da 100644
--- a/src/main/java/org/globsframework/functional/impl/TwoFieldsMutableKey.java
+++ b/src/main/java/org/globsframework/functional/impl/TwoFieldsMutableKey.java
@@ -3,7 +3,7 @@
import org.globsframework.functional.FunctionalKey;
import org.globsframework.functional.FunctionalKeyBuilder;
import org.globsframework.functional.MutableFunctionalKey;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValue;
import org.globsframework.utils.exceptions.ItemNotFound;
diff --git a/src/main/java/org/globsframework/functional/impl/TwoFunctionalKeyBuilder.java b/src/main/java/org/globsframework/functional/impl/TwoFunctionalKeyBuilder.java
index 3c055bd..118e3e3 100644
--- a/src/main/java/org/globsframework/functional/impl/TwoFunctionalKeyBuilder.java
+++ b/src/main/java/org/globsframework/functional/impl/TwoFunctionalKeyBuilder.java
@@ -3,7 +3,7 @@
import org.globsframework.functional.FunctionalKey;
import org.globsframework.functional.FunctionalKeyBuilder;
import org.globsframework.functional.MutableFunctionalKey;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValues;
diff --git a/src/main/java/org/globsframework/metamodel/Annotations.java b/src/main/java/org/globsframework/metamodel/Annotations.java
index e074e2e..9b65dad 100644
--- a/src/main/java/org/globsframework/metamodel/Annotations.java
+++ b/src/main/java/org/globsframework/metamodel/Annotations.java
@@ -1,5 +1,6 @@
package org.globsframework.metamodel;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.impl.DefaultAnnotations;
import org.globsframework.model.Glob;
import org.globsframework.model.Key;
diff --git a/src/main/java/org/globsframework/metamodel/GlobModel.java b/src/main/java/org/globsframework/metamodel/GlobModel.java
index b58de3c..b6f572a 100644
--- a/src/main/java/org/globsframework/metamodel/GlobModel.java
+++ b/src/main/java/org/globsframework/metamodel/GlobModel.java
@@ -1,9 +1,6 @@
package org.globsframework.metamodel;
-import org.globsframework.metamodel.properties.Property;
-import org.globsframework.metamodel.properties.impl.PropertiesBuilder;
import org.globsframework.metamodel.utils.GlobTypeDependencies;
-import org.globsframework.utils.exceptions.ItemNotFound;
import java.util.Collection;
@@ -17,11 +14,5 @@ public interface GlobModel extends Iterable, GlobTypeResolver {
GlobTypeDependencies getDependencies();
-
- Property createGlobTypeProperty(String name, final PropertiesBuilder.PropertyBuilder valueBuilder);
-
-
- Property createFieldProperty(String name, final PropertiesBuilder.PropertyBuilder fieldValueBuilder);
-
GlobLinkModel getLinkModel();
}
diff --git a/src/main/java/org/globsframework/metamodel/GlobType.java b/src/main/java/org/globsframework/metamodel/GlobType.java
index 6176046..c972d81 100644
--- a/src/main/java/org/globsframework/metamodel/GlobType.java
+++ b/src/main/java/org/globsframework/metamodel/GlobType.java
@@ -1,22 +1,22 @@
package org.globsframework.metamodel;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.FieldVisitor;
import org.globsframework.metamodel.fields.FieldVisitorWithContext;
import org.globsframework.metamodel.impl.DefaultValuesFieldVisitor;
import org.globsframework.metamodel.index.Index;
-import org.globsframework.metamodel.properties.PropertyHolder;
+import org.globsframework.metamodel.utils.MutableAnnotations;
import org.globsframework.model.GlobFactory;
import org.globsframework.model.Key;
import org.globsframework.model.MutableGlob;
import org.globsframework.utils.exceptions.ItemNotFound;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Optional;
import java.util.stream.Stream;
-public interface GlobType extends PropertyHolder, Annotations {
+public interface GlobType extends MutableAnnotations {
String getName();
diff --git a/src/main/java/org/globsframework/metamodel/GlobTypeLoader.java b/src/main/java/org/globsframework/metamodel/GlobTypeLoader.java
index 88f41f4..69a73dd 100644
--- a/src/main/java/org/globsframework/metamodel/GlobTypeLoader.java
+++ b/src/main/java/org/globsframework/metamodel/GlobTypeLoader.java
@@ -1,5 +1,6 @@
package org.globsframework.metamodel;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.index.MultiFieldNotUniqueIndex;
import org.globsframework.metamodel.index.MultiFieldUniqueIndex;
import org.globsframework.metamodel.index.NotUniqueIndex;
diff --git a/src/main/java/org/globsframework/metamodel/MutableGlobLinkModel.java b/src/main/java/org/globsframework/metamodel/MutableGlobLinkModel.java
index a8a354f..aed1119 100644
--- a/src/main/java/org/globsframework/metamodel/MutableGlobLinkModel.java
+++ b/src/main/java/org/globsframework/metamodel/MutableGlobLinkModel.java
@@ -1,5 +1,6 @@
package org.globsframework.metamodel;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.links.DirectLink;
import org.globsframework.metamodel.links.Link;
import org.globsframework.metamodel.utils.MutableAnnotations;
@@ -44,7 +45,7 @@ interface DirectLinkBuilder extends LinkBuilder {
DirectLink publish();
}
- interface LinkBuilder extends MutableAnnotations {
+ interface LinkBuilder extends MutableAnnotations {
T add(Field sourceField, Field targetField);
diff --git a/src/main/java/org/globsframework/metamodel/annotations/EnumAnnotationType.java b/src/main/java/org/globsframework/metamodel/annotations/EnumAnnotationType.java
index 6ed88ff..9d07e5e 100644
--- a/src/main/java/org/globsframework/metamodel/annotations/EnumAnnotationType.java
+++ b/src/main/java/org/globsframework/metamodel/annotations/EnumAnnotationType.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.GlobTypeLoaderFactory;
import org.globsframework.metamodel.fields.StringArrayField;
diff --git a/src/main/java/org/globsframework/metamodel/annotations/FieldNameAnnotationType.java b/src/main/java/org/globsframework/metamodel/annotations/FieldNameAnnotationType.java
index 4f51a36..dac8b7a 100644
--- a/src/main/java/org/globsframework/metamodel/annotations/FieldNameAnnotationType.java
+++ b/src/main/java/org/globsframework/metamodel/annotations/FieldNameAnnotationType.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.StringField;
import org.globsframework.metamodel.impl.DefaultFieldFactory;
diff --git a/src/main/java/org/globsframework/metamodel/annotations/MaxSizeType.java b/src/main/java/org/globsframework/metamodel/annotations/MaxSizeType.java
index c668174..cdaca14 100644
--- a/src/main/java/org/globsframework/metamodel/annotations/MaxSizeType.java
+++ b/src/main/java/org/globsframework/metamodel/annotations/MaxSizeType.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.GlobTypeLoader;
import org.globsframework.metamodel.GlobTypeLoaderFactory;
diff --git a/src/main/java/org/globsframework/metamodel/annotations/NameAnnotationType.java b/src/main/java/org/globsframework/metamodel/annotations/NameAnnotationType.java
index 27a907c..3f41f57 100644
--- a/src/main/java/org/globsframework/metamodel/annotations/NameAnnotationType.java
+++ b/src/main/java/org/globsframework/metamodel/annotations/NameAnnotationType.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.GlobTypeLoaderFactory;
import org.globsframework.metamodel.fields.StringField;
diff --git a/src/main/java/org/globsframework/metamodel/fields/BigDecimalArrayField.java b/src/main/java/org/globsframework/metamodel/fields/BigDecimalArrayField.java
index 9a378a6..0e7ee65 100644
--- a/src/main/java/org/globsframework/metamodel/fields/BigDecimalArrayField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/BigDecimalArrayField.java
@@ -1,12 +1,11 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.math.BigDecimal;
import java.util.function.Function;
-public interface BigDecimalArrayField extends Field, Function {
+public non-sealed interface BigDecimalArrayField extends Field, Function {
default BigDecimal[] apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/BigDecimalField.java b/src/main/java/org/globsframework/metamodel/fields/BigDecimalField.java
index caa36e2..7a32179 100644
--- a/src/main/java/org/globsframework/metamodel/fields/BigDecimalField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/BigDecimalField.java
@@ -1,12 +1,11 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.math.BigDecimal;
import java.util.function.Function;
-public interface BigDecimalField extends Field, Function {
+public non-sealed interface BigDecimalField extends Field, Function {
default BigDecimal apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/BlobField.java b/src/main/java/org/globsframework/metamodel/fields/BlobField.java
index c3008b6..14fba49 100644
--- a/src/main/java/org/globsframework/metamodel/fields/BlobField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/BlobField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface BlobField extends Field, Function {
+public non-sealed interface BlobField extends Field, Function {
default byte[] apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/BooleanArrayField.java b/src/main/java/org/globsframework/metamodel/fields/BooleanArrayField.java
index 79dd97c..985fb2b 100644
--- a/src/main/java/org/globsframework/metamodel/fields/BooleanArrayField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/BooleanArrayField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface BooleanArrayField extends Field, Function {
+public non-sealed interface BooleanArrayField extends Field, Function {
default boolean[] apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/BooleanField.java b/src/main/java/org/globsframework/metamodel/fields/BooleanField.java
index f5d2409..e3f310e 100644
--- a/src/main/java/org/globsframework/metamodel/fields/BooleanField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/BooleanField.java
@@ -1,12 +1,11 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
import java.util.function.Predicate;
-public interface BooleanField extends Field, Function, Predicate {
+public non-sealed interface BooleanField extends Field, Function, Predicate {
default Boolean apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/DateField.java b/src/main/java/org/globsframework/metamodel/fields/DateField.java
index fd290f7..6ecd734 100644
--- a/src/main/java/org/globsframework/metamodel/fields/DateField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/DateField.java
@@ -1,12 +1,11 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.time.LocalDate;
import java.util.function.Function;
-public interface DateField extends Field, Function {
+public non-sealed interface DateField extends Field, Function {
default LocalDate apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/DateTimeField.java b/src/main/java/org/globsframework/metamodel/fields/DateTimeField.java
index 7c1aa75..55bd7f8 100644
--- a/src/main/java/org/globsframework/metamodel/fields/DateTimeField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/DateTimeField.java
@@ -1,12 +1,11 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.time.ZonedDateTime;
import java.util.function.Function;
-public interface DateTimeField extends Field, Function {
+public non-sealed interface DateTimeField extends Field, Function {
default ZonedDateTime apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/DoubleArrayField.java b/src/main/java/org/globsframework/metamodel/fields/DoubleArrayField.java
index c7359d6..3d3a52a 100644
--- a/src/main/java/org/globsframework/metamodel/fields/DoubleArrayField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/DoubleArrayField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface DoubleArrayField extends Field, Function {
+public non-sealed interface DoubleArrayField extends Field, Function {
default double[] apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/DoubleField.java b/src/main/java/org/globsframework/metamodel/fields/DoubleField.java
index 01ef57f..35b3a08 100644
--- a/src/main/java/org/globsframework/metamodel/fields/DoubleField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/DoubleField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface DoubleField extends Field, Function {
+public non-sealed interface DoubleField extends Field, Function {
default Double apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/Field.java b/src/main/java/org/globsframework/metamodel/fields/Field.java
similarity index 90%
rename from src/main/java/org/globsframework/metamodel/Field.java
rename to src/main/java/org/globsframework/metamodel/fields/Field.java
index d714aeb..46422db 100644
--- a/src/main/java/org/globsframework/metamodel/Field.java
+++ b/src/main/java/org/globsframework/metamodel/fields/Field.java
@@ -1,13 +1,14 @@
-package org.globsframework.metamodel;
+package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.fields.*;
-import org.globsframework.metamodel.properties.PropertyHolder;
+import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.type.DataType;
import org.globsframework.metamodel.utils.MutableAnnotations;
import org.globsframework.model.FieldValuesAccessor;
import org.globsframework.utils.exceptions.InvalidParameter;
-public interface Field extends PropertyHolder, MutableAnnotations {
+public sealed interface Field extends MutableAnnotations
+ permits BooleanField, IntegerField, LongField, StringField, DoubleField, BlobField, BigDecimalField, DateField, DateTimeField, GlobField, GlobUnionField,
+ BooleanArrayField, IntegerArrayField, LongArrayField, StringArrayField, DoubleArrayField, BigDecimalArrayField, GlobArrayField, GlobArrayUnionField {
String getName();
@@ -29,7 +30,7 @@ public interface Field extends PropertyHolder, MutableAnnotations
T safeVisit(T visitor);
- , C> T visit(T visitor, C context) throws Exception;
+ , C> T visit(T visitor, C context) throws Exception;
, C> T safeVisit(T visitor, C context);
@@ -43,7 +44,7 @@ public interface Field extends PropertyHolder, MutableAnnotations
, Context> T safeVisitValue(T visitor, Object value, Context context);
- default , Context> T safeVisitValue(T visitor, FieldValuesAccessor value, Context context){
+ default , Context> T safeVisitValue(T visitor, FieldValuesAccessor value, Context context) {
return safeVisitValue(visitor, value.getValue(this), context);
}
@@ -124,28 +125,28 @@ default DateTimeField asDateTimeField() {
return (DateTimeField) this;
}
- default GlobArrayField asGlobArrayField(){
+ default GlobArrayField asGlobArrayField() {
if (!(this instanceof GlobArrayField)) {
throw new RuntimeException(getFullName() + " is not a GlobArrayField but a " + getDataType());
}
return (GlobArrayField) this;
}
- default GlobField asGlobField(){
+ default GlobField asGlobField() {
if (!(this instanceof GlobField)) {
throw new RuntimeException(getFullName() + " is not a GlobField but a " + getDataType());
}
return (GlobField) this;
}
- default GlobArrayUnionField asGlobArrayUnionField(){
+ default GlobArrayUnionField asGlobArrayUnionField() {
if (!(this instanceof GlobArrayUnionField)) {
throw new RuntimeException(getFullName() + " is not a GlobArrayUnionField but a " + getDataType());
}
return (GlobArrayUnionField) this;
}
- default GlobUnionField asGlobUnionField(){
+ default GlobUnionField asGlobUnionField() {
if (!(this instanceof GlobUnionField)) {
throw new RuntimeException(getFullName() + " is not a GlobUnionField but a " + getDataType());
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/FieldValueVisitor.java b/src/main/java/org/globsframework/metamodel/fields/FieldValueVisitor.java
index fe355bd..6c5da31 100644
--- a/src/main/java/org/globsframework/metamodel/fields/FieldValueVisitor.java
+++ b/src/main/java/org/globsframework/metamodel/fields/FieldValueVisitor.java
@@ -1,6 +1,5 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.metamodel.fields.impl.FieldValueVisitorButKey;
import org.globsframework.model.Glob;
diff --git a/src/main/java/org/globsframework/metamodel/fields/FieldValueVisitorWithContext.java b/src/main/java/org/globsframework/metamodel/fields/FieldValueVisitorWithContext.java
index d20a275..682de8d 100644
--- a/src/main/java/org/globsframework/metamodel/fields/FieldValueVisitorWithContext.java
+++ b/src/main/java/org/globsframework/metamodel/fields/FieldValueVisitorWithContext.java
@@ -1,6 +1,5 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.Glob;
import java.math.BigDecimal;
diff --git a/src/main/java/org/globsframework/metamodel/fields/FieldVisitor.java b/src/main/java/org/globsframework/metamodel/fields/FieldVisitor.java
index e7d52f0..941ee0f 100644
--- a/src/main/java/org/globsframework/metamodel/fields/FieldVisitor.java
+++ b/src/main/java/org/globsframework/metamodel/fields/FieldVisitor.java
@@ -1,7 +1,5 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
-
public interface FieldVisitor {
void visitInteger(IntegerField field) throws Exception;
diff --git a/src/main/java/org/globsframework/metamodel/fields/FieldVisitorWithContext.java b/src/main/java/org/globsframework/metamodel/fields/FieldVisitorWithContext.java
index 5b7c074..b3d884d 100644
--- a/src/main/java/org/globsframework/metamodel/fields/FieldVisitorWithContext.java
+++ b/src/main/java/org/globsframework/metamodel/fields/FieldVisitorWithContext.java
@@ -1,7 +1,5 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
-
public interface FieldVisitorWithContext {
void visitInteger(IntegerField field, C context) throws Exception;
diff --git a/src/main/java/org/globsframework/metamodel/fields/FieldVisitorWithTwoContext.java b/src/main/java/org/globsframework/metamodel/fields/FieldVisitorWithTwoContext.java
index 5196322..4b87108 100644
--- a/src/main/java/org/globsframework/metamodel/fields/FieldVisitorWithTwoContext.java
+++ b/src/main/java/org/globsframework/metamodel/fields/FieldVisitorWithTwoContext.java
@@ -1,7 +1,5 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
-
public interface FieldVisitorWithTwoContext {
void visitInteger(IntegerField field, C ctx1, D ctx2) throws Exception;
diff --git a/src/main/java/org/globsframework/metamodel/fields/GlobArrayField.java b/src/main/java/org/globsframework/metamodel/fields/GlobArrayField.java
index 7995775..7fc496d 100644
--- a/src/main/java/org/globsframework/metamodel/fields/GlobArrayField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/GlobArrayField.java
@@ -1,6 +1,5 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValuesAccessor;
import org.globsframework.model.Glob;
@@ -8,7 +7,7 @@
import java.util.function.Function;
import java.util.stream.Stream;
-public interface GlobArrayField extends Field, Function {
+public non-sealed interface GlobArrayField extends Field, Function {
GlobType getTargetType();
default Glob[] apply(FieldValuesAccessor glob) {
diff --git a/src/main/java/org/globsframework/metamodel/fields/GlobArrayUnionField.java b/src/main/java/org/globsframework/metamodel/fields/GlobArrayUnionField.java
index 5a828e3..add2023 100644
--- a/src/main/java/org/globsframework/metamodel/fields/GlobArrayUnionField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/GlobArrayUnionField.java
@@ -1,6 +1,5 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValuesAccessor;
import org.globsframework.model.Glob;
@@ -9,7 +8,7 @@
import java.util.function.Function;
import java.util.stream.Stream;
-public interface GlobArrayUnionField extends Field, Function {
+public non-sealed interface GlobArrayUnionField extends Field, Function {
Collection getTargetTypes();
GlobType getTargetType(String name);
diff --git a/src/main/java/org/globsframework/metamodel/fields/GlobField.java b/src/main/java/org/globsframework/metamodel/fields/GlobField.java
index 8647513..863115e 100644
--- a/src/main/java/org/globsframework/metamodel/fields/GlobField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/GlobField.java
@@ -1,13 +1,12 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValuesAccessor;
import org.globsframework.model.Glob;
import java.util.function.Function;
-public interface GlobField extends Field, Function {
+public non-sealed interface GlobField extends Field, Function {
GlobType getTargetType();
default Glob apply(FieldValuesAccessor glob) {
diff --git a/src/main/java/org/globsframework/metamodel/fields/GlobUnionField.java b/src/main/java/org/globsframework/metamodel/fields/GlobUnionField.java
index b0193c7..2e31e60 100644
--- a/src/main/java/org/globsframework/metamodel/fields/GlobUnionField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/GlobUnionField.java
@@ -1,6 +1,5 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValuesAccessor;
import org.globsframework.model.Glob;
@@ -8,7 +7,7 @@
import java.util.Collection;
import java.util.function.Function;
-public interface GlobUnionField extends Field, Function {
+public non-sealed interface GlobUnionField extends Field, Function {
Collection getTargetTypes();
GlobType getTargetType(String name);
diff --git a/src/main/java/org/globsframework/metamodel/fields/IntegerArrayField.java b/src/main/java/org/globsframework/metamodel/fields/IntegerArrayField.java
index 7ba24ea..70c2270 100644
--- a/src/main/java/org/globsframework/metamodel/fields/IntegerArrayField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/IntegerArrayField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface IntegerArrayField extends Field, Function {
+public non-sealed interface IntegerArrayField extends Field, Function {
default int[] apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/IntegerField.java b/src/main/java/org/globsframework/metamodel/fields/IntegerField.java
index 073990b..96b817c 100644
--- a/src/main/java/org/globsframework/metamodel/fields/IntegerField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/IntegerField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface IntegerField extends Field, Function {
+public non-sealed interface IntegerField extends Field, Function {
default Integer apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/LongArrayField.java b/src/main/java/org/globsframework/metamodel/fields/LongArrayField.java
index fa33372..3b31f85 100644
--- a/src/main/java/org/globsframework/metamodel/fields/LongArrayField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/LongArrayField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface LongArrayField extends Field, Function {
+public non-sealed interface LongArrayField extends Field, Function {
default long[] apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/LongField.java b/src/main/java/org/globsframework/metamodel/fields/LongField.java
index d28cf36..6ae286f 100644
--- a/src/main/java/org/globsframework/metamodel/fields/LongField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/LongField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface LongField extends Field, Function {
+public non-sealed interface LongField extends Field, Function {
default Long apply(FieldValuesAccessor data) {
return data.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/StringArrayField.java b/src/main/java/org/globsframework/metamodel/fields/StringArrayField.java
index d903b96..aee0cf6 100644
--- a/src/main/java/org/globsframework/metamodel/fields/StringArrayField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/StringArrayField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface StringArrayField extends Field, Function {
+public non-sealed interface StringArrayField extends Field, Function {
default String[] apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/StringField.java b/src/main/java/org/globsframework/metamodel/fields/StringField.java
index 26b6112..d66fdf8 100644
--- a/src/main/java/org/globsframework/metamodel/fields/StringField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/StringField.java
@@ -1,11 +1,10 @@
package org.globsframework.metamodel.fields;
-import org.globsframework.metamodel.Field;
import org.globsframework.model.FieldValuesAccessor;
import java.util.function.Function;
-public interface StringField extends Field, Function {
+public non-sealed interface StringField extends Field, Function {
default String apply(FieldValuesAccessor glob) {
return glob.get(this);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/impl/AbstractField.java b/src/main/java/org/globsframework/metamodel/fields/impl/AbstractField.java
index ec42100..7d76adb 100644
--- a/src/main/java/org/globsframework/metamodel/fields/impl/AbstractField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/impl/AbstractField.java
@@ -1,17 +1,13 @@
package org.globsframework.metamodel.fields.impl;
-import org.globsframework.metamodel.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.annotations.RequiredAnnotationType;
import org.globsframework.metamodel.impl.DefaultAnnotations;
-import org.globsframework.metamodel.properties.impl.AbstractDelegatePropertyHolder;
import org.globsframework.metamodel.type.DataType;
import org.globsframework.utils.Utils;
import org.globsframework.utils.exceptions.InvalidParameter;
-import java.util.Objects;
-
-abstract public class AbstractField extends DefaultAnnotations implements Field, AbstractDelegatePropertyHolder {
+abstract public class AbstractField extends DefaultAnnotations {
private final int index;
private final int keyIndex;
private final GlobType globType;
@@ -19,7 +15,6 @@ abstract public class AbstractField extends DefaultAnnotations implements
private final Class valueClass;
private final Object defaultValue;
private final DataType dataType;
- private volatile Object[] properties = new Object[]{NULL_OBJECT, NULL_OBJECT};
private final boolean keyField;
protected AbstractField(String name, GlobType globType,
@@ -74,8 +69,8 @@ public DataType getDataType() {
public void checkValue(Object object) throws InvalidParameter {
if ((object != null) && (!valueClass.equals(object.getClass()))) {
throw new InvalidParameter("Value '" + object + "' (" + object.getClass().getName()
- + ") is not authorized for field: " + getName() +
- " (expected " + valueClass.getName() + ")");
+ + ") is not authorized for field: " + getName() +
+ " (expected " + valueClass.getName() + ")");
}
}
@@ -103,18 +98,6 @@ public int valueHash(Object o) {
return o.hashCode();
}
- final public Object[] getProperties() {
- return properties;
- }
-
- final public void setProperties(Object[] properties) {
- this.properties = properties;
- }
-
- final public Field getValueOwner() {
- return this;
- }
-
public void toString(StringBuilder buffer, Object value) {
buffer.append(value);
}
@@ -127,7 +110,7 @@ public boolean equals(Object o) {
return false;
}
- AbstractField other = (AbstractField)o;
+ AbstractField other = (AbstractField) o;
return globType.equals(other.globType) && name.equals(other.name);
}
diff --git a/src/main/java/org/globsframework/metamodel/fields/impl/DefaultGlobField.java b/src/main/java/org/globsframework/metamodel/fields/impl/DefaultGlobField.java
index dc7a7b3..e25f6f2 100644
--- a/src/main/java/org/globsframework/metamodel/fields/impl/DefaultGlobField.java
+++ b/src/main/java/org/globsframework/metamodel/fields/impl/DefaultGlobField.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.fields.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.metamodel.type.DataType;
diff --git a/src/main/java/org/globsframework/metamodel/impl/DefaultAnnotations.java b/src/main/java/org/globsframework/metamodel/impl/DefaultAnnotations.java
index f33d828..2cbf440 100644
--- a/src/main/java/org/globsframework/metamodel/impl/DefaultAnnotations.java
+++ b/src/main/java/org/globsframework/metamodel/impl/DefaultAnnotations.java
@@ -14,7 +14,7 @@
import java.util.Map;
import java.util.stream.Stream;
-public class DefaultAnnotations implements MutableAnnotations {
+public class DefaultAnnotations implements MutableAnnotations {
static private final Logger LOGGER = LoggerFactory.getLogger(DefaultAnnotations.class);
volatile private Map annotations = new LinkedHashMap<>();
@@ -33,7 +33,7 @@ public DefaultAnnotations(Annotations annotations) {
);
}
- public T addAnnotation(Glob glob) {
+ public MutableAnnotations addAnnotation(Glob glob) {
if (glob != null) {
synchronized (this) {
Map tmp = new LinkedHashMap<>(annotations);
@@ -44,10 +44,10 @@ public T addAnnotation(Glob glob) {
annotations = tmp;
}
}
- return (T) this;
+ return this;
}
- public T addAnnotations(Stream globs) {
+ public MutableAnnotations addAnnotations(Stream globs) {
synchronized (this) {
Map tmp = new LinkedHashMap<>(annotations);
globs.forEach(glob -> {
@@ -59,7 +59,7 @@ public T addAnnotations(Stream globs) {
annotations = tmp;
}
- return (T) this;
+ return this;
}
public Stream streamAnnotations() {
diff --git a/src/main/java/org/globsframework/metamodel/impl/DefaultFieldFactory.java b/src/main/java/org/globsframework/metamodel/impl/DefaultFieldFactory.java
index d174e3c..06a9511 100644
--- a/src/main/java/org/globsframework/metamodel/impl/DefaultFieldFactory.java
+++ b/src/main/java/org/globsframework/metamodel/impl/DefaultFieldFactory.java
@@ -1,7 +1,7 @@
package org.globsframework.metamodel.impl;
import org.globsframework.metamodel.Annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.annotations.DefaultFieldValueType;
import org.globsframework.metamodel.fields.impl.*;
@@ -139,7 +139,7 @@ public DefaultGlobUnionArrayField addGlobArrayUnion(String fieldName, Collection
}
- private T add(T field, boolean isKeyField) {
+ private T add(T field, boolean isKeyField) {
type.addField(field);
if (isKeyField) {
type.addKey(field);
diff --git a/src/main/java/org/globsframework/metamodel/impl/DefaultGlobFactory.java b/src/main/java/org/globsframework/metamodel/impl/DefaultGlobFactory.java
index d72cff1..a9194b5 100644
--- a/src/main/java/org/globsframework/metamodel/impl/DefaultGlobFactory.java
+++ b/src/main/java/org/globsframework/metamodel/impl/DefaultGlobFactory.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.Glob;
@@ -11,12 +11,14 @@
import org.globsframework.model.globaccessor.set.GlobSetAccessor;
import org.globsframework.model.globaccessor.set.impl.*;
import org.globsframework.model.impl.DefaultGlob;
+import org.globsframework.model.impl.DefaultGlob128;
+import org.globsframework.model.impl.DefaultGlob64;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZonedDateTime;
-class DefaultGlobFactory implements GlobFactory {
+public class DefaultGlobFactory implements GlobFactory {
private final GlobType type;
private final GlobGetAccessor getAccessor[];
private final GlobSetAccessor setAccessor[];
@@ -33,6 +35,12 @@ public DefaultGlobFactory(GlobType type) {
}
public MutableGlob create() {
+ if (type.getFieldCount() <= 64) {
+ return new DefaultGlob64(type);
+ }
+ if (type.getFieldCount() <= 128) {
+ return new DefaultGlob128(type);
+ }
return new DefaultGlob(type);
}
diff --git a/src/main/java/org/globsframework/metamodel/impl/DefaultGlobModel.java b/src/main/java/org/globsframework/metamodel/impl/DefaultGlobModel.java
index a4948df..2a80b27 100644
--- a/src/main/java/org/globsframework/metamodel/impl/DefaultGlobModel.java
+++ b/src/main/java/org/globsframework/metamodel/impl/DefaultGlobModel.java
@@ -2,10 +2,7 @@
import org.globsframework.metamodel.*;
import org.globsframework.metamodel.links.impl.DefaultMutableGlobLinkModel;
-import org.globsframework.metamodel.properties.Property;
-import org.globsframework.metamodel.properties.impl.PropertiesBuilder;
import org.globsframework.metamodel.utils.GlobTypeDependencies;
-import org.globsframework.utils.exceptions.ItemNotFound;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -18,8 +15,6 @@ public class DefaultGlobModel implements MutableGlobModel {
private GlobModel innerModel;
private GlobTypeDependencies dependencies;
private DefaultMutableGlobLinkModel globLinkModel;
- private PropertiesBuilder globTypePropertiesBuilder = new PropertiesBuilder<>();
- private PropertiesBuilder fieldPropertiesBuilder = new PropertiesBuilder<>();
public DefaultGlobModel(GlobType... types) {
this(null, types);
@@ -62,26 +57,10 @@ public GlobTypeDependencies getDependencies() {
return dependencies;
}
- public Property createFieldProperty(String name,
- final PropertiesBuilder.PropertyBuilder fieldValueBuilder) {
- if (innerModel != null) {
- return innerModel.createFieldProperty(name, fieldValueBuilder);
- }
- return fieldPropertiesBuilder.createProperty(name, fieldValueBuilder);
- }
-
public GlobLinkModel getLinkModel() {
return globLinkModel;
}
- public Property createGlobTypeProperty(String name,
- final PropertiesBuilder.PropertyBuilder valueBuilder) {
- if (innerModel != null) {
- return innerModel.createGlobTypeProperty(name, valueBuilder);
- }
- return globTypePropertiesBuilder.createProperty(name, valueBuilder);
- }
-
private void add(GlobType... types) {
Arrays.stream(types).forEach(this::add);
}
diff --git a/src/main/java/org/globsframework/metamodel/impl/DefaultGlobType.java b/src/main/java/org/globsframework/metamodel/impl/DefaultGlobType.java
index f7680da..c429e08 100644
--- a/src/main/java/org/globsframework/metamodel/impl/DefaultGlobType.java
+++ b/src/main/java/org/globsframework/metamodel/impl/DefaultGlobType.java
@@ -1,13 +1,10 @@
package org.globsframework.metamodel.impl;
-import org.globsframework.metamodel.Field;
-import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.annotations.KeyAnnotationType;
-import org.globsframework.metamodel.fields.impl.AbstractField;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.index.Index;
import org.globsframework.metamodel.index.MultiFieldIndex;
import org.globsframework.metamodel.index.SingleFieldIndex;
-import org.globsframework.metamodel.properties.impl.AbstractDelegatePropertyHolder;
import org.globsframework.metamodel.utils.MutableAnnotations;
import org.globsframework.metamodel.utils.MutableGlobType;
import org.globsframework.model.Glob;
@@ -22,13 +19,11 @@
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
-public class DefaultGlobType extends DefaultAnnotations implements MutableGlobType, MutableAnnotations,
- AbstractDelegatePropertyHolder {
+public class DefaultGlobType extends DefaultAnnotations implements MutableGlobType, MutableAnnotations {
public static final String[] EMPTY_SCOPE = new String[0];
private Field[] fields;
private Field[] keyFields = new Field[0];
@@ -39,7 +34,6 @@ public class DefaultGlobType extends DefaultAnnotations implements MutableGlobTy
private Map fieldsByName = new HashMap<>();
private Map indices = new HashMap<>(2, 1);
private Map registered = new ConcurrentHashMap<>();
- private volatile Object properties[] = new Object[]{NULL_OBJECT, NULL_OBJECT};
public DefaultGlobType(String name) {
this(null, name);
@@ -63,7 +57,7 @@ public Field getField(String name) throws ItemNotFound {
}
public T getTypedField(String name) throws ItemNotFound {
- return (T)getField(name);
+ return (T) getField(name);
}
public boolean hasField(String name) {
@@ -91,10 +85,10 @@ public String getName() {
}
- public void addField(AbstractField field) {
+ public void addField(Field field) {
if (hasField(field.getName())) {
throw new ItemAlreadyExists("Field " + field.getName() +
- " declared twice for type " + getName());
+ " declared twice for type " + getName());
}
if (field.getIndex() != fieldsByName.size()) {
throw new InvalidState(field + " should be at index " + field.getIndex() + " but is at" + fieldsByName.size());
@@ -179,7 +173,7 @@ public void completeInit() {
if (cmp == null) {
cmp = Comparator.comparing(key -> (Comparable) key.getValue(keyField));
} else {
- cmp = cmp.thenComparing(key -> (Comparable)key.getValue(keyField));
+ cmp = cmp.thenComparing(key -> (Comparable) key.getValue(keyField));
}
}
this.keyComparator = cmp;
@@ -210,25 +204,13 @@ public void register(Class klass, T t) {
}
public T getRegistered(Class klass) {
- return (T)registered.get(klass);
+ return (T) registered.get(klass);
}
public T getRegistered(Class klass, T NULL) {
return (T) registered.getOrDefault(klass, NULL);
}
- final public Object[] getProperties() {
- return properties;
- }
-
- final public void setProperties(Object[] properties) {
- this.properties = properties;
- }
-
- final public GlobType getValueOwner() {
- return this;
- }
-
public String describe() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("'").append(name).append("' : ");
diff --git a/src/main/java/org/globsframework/metamodel/impl/DefaultGlobTypeBuilder.java b/src/main/java/org/globsframework/metamodel/impl/DefaultGlobTypeBuilder.java
index 6a5e2e1..16f349c 100644
--- a/src/main/java/org/globsframework/metamodel/impl/DefaultGlobTypeBuilder.java
+++ b/src/main/java/org/globsframework/metamodel/impl/DefaultGlobTypeBuilder.java
@@ -1,7 +1,7 @@
package org.globsframework.metamodel.impl;
import org.globsframework.metamodel.Annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.GlobTypeBuilder;
import org.globsframework.metamodel.annotations.*;
diff --git a/src/main/java/org/globsframework/metamodel/impl/GlobTypeLoaderImpl.java b/src/main/java/org/globsframework/metamodel/impl/GlobTypeLoaderImpl.java
index 2ee95fe..51162d5 100644
--- a/src/main/java/org/globsframework/metamodel/impl/GlobTypeLoaderImpl.java
+++ b/src/main/java/org/globsframework/metamodel/impl/GlobTypeLoaderImpl.java
@@ -66,7 +66,7 @@ private void processOther(Class> targetClass) {
for (java.lang.reflect.Field classField : targetClass.getFields()) {
List processor = fieldInitializeProcessorService.get(classField);
if (processor != null && !processor.isEmpty()) {
- DefaultAnnotations annotations = new DefaultAnnotations<>();
+ DefaultAnnotations annotations = new DefaultAnnotations();
processFieldAnnotations(classField, annotations);
annotations.addAnnotation(FieldNameAnnotationType.create(getFieldName(classField)));
applyProcessor(targetClass, classField, processor, annotations);
@@ -86,7 +86,7 @@ private void processOther(Class> targetClass) {
}
private void applyProcessor(Class> targetClass, java.lang.reflect.Field classField, List processor,
- DefaultAnnotations annotations) {
+ MutableAnnotations annotations) {
for (FieldInitializeProcessor fieldInitializeProcessor : processor) {
Object value = fieldInitializeProcessor.getValue(type, annotations, classField.getAnnotations());
if (value instanceof MutableAnnotations) {
@@ -145,7 +145,7 @@ private void createType(java.lang.reflect.Field classField,
GlobTypeLoaderImpl.setClassField(classField, type, targetClass);
}
- private void processFieldAnnotations(java.lang.reflect.Field field, MutableAnnotations annotations) {
+ private void processFieldAnnotations(java.lang.reflect.Field field, MutableAnnotations annotations) {
for (Annotation annotation : field.getAnnotations()) {
Glob globAnnotation = processAnnotation(annotation);
if (globAnnotation != null) {
@@ -419,7 +419,7 @@ private static RuntimeException getFieldAccessException(Class> targetClass, ja
" with value " + valueDescription, e);
}
- GlobTypeLoader addField(AbstractField field) throws ItemAlreadyExists {
+ GlobTypeLoader addField(Field field) throws ItemAlreadyExists {
if (type.hasField(field.getName())) {
throw new ItemAlreadyExists("Field " + field.getName() +
" declared twice for type " + type.getName());
diff --git a/src/main/java/org/globsframework/metamodel/index/Index.java b/src/main/java/org/globsframework/metamodel/index/Index.java
index dbc02d4..05f238e 100644
--- a/src/main/java/org/globsframework/metamodel/index/Index.java
+++ b/src/main/java/org/globsframework/metamodel/index/Index.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.index;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import java.util.stream.Stream;
diff --git a/src/main/java/org/globsframework/metamodel/index/MultiFieldIndex.java b/src/main/java/org/globsframework/metamodel/index/MultiFieldIndex.java
index 7e521c5..5e977ea 100644
--- a/src/main/java/org/globsframework/metamodel/index/MultiFieldIndex.java
+++ b/src/main/java/org/globsframework/metamodel/index/MultiFieldIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.index;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
public interface MultiFieldIndex extends Index {
diff --git a/src/main/java/org/globsframework/metamodel/index/SingleFieldIndex.java b/src/main/java/org/globsframework/metamodel/index/SingleFieldIndex.java
index 4a10cc7..d7c4b37 100644
--- a/src/main/java/org/globsframework/metamodel/index/SingleFieldIndex.java
+++ b/src/main/java/org/globsframework/metamodel/index/SingleFieldIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.index;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
public interface SingleFieldIndex extends Index {
Field getField();
diff --git a/src/main/java/org/globsframework/metamodel/index/impl/AbstractMultiFieldIndex.java b/src/main/java/org/globsframework/metamodel/index/impl/AbstractMultiFieldIndex.java
index d1d64e1..315d0e1 100644
--- a/src/main/java/org/globsframework/metamodel/index/impl/AbstractMultiFieldIndex.java
+++ b/src/main/java/org/globsframework/metamodel/index/impl/AbstractMultiFieldIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.index.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.index.MultiFieldIndex;
import java.util.stream.Stream;
diff --git a/src/main/java/org/globsframework/metamodel/index/impl/AbstractSingleIndex.java b/src/main/java/org/globsframework/metamodel/index/impl/AbstractSingleIndex.java
index 7c64667..419fdf7 100644
--- a/src/main/java/org/globsframework/metamodel/index/impl/AbstractSingleIndex.java
+++ b/src/main/java/org/globsframework/metamodel/index/impl/AbstractSingleIndex.java
@@ -1,8 +1,7 @@
package org.globsframework.metamodel.index.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.index.SingleFieldIndex;
-import org.globsframework.metamodel.index.UniqueIndex;
import java.util.stream.Stream;
diff --git a/src/main/java/org/globsframework/metamodel/index/impl/DefaultMultiFieldNotUniqueIndex.java b/src/main/java/org/globsframework/metamodel/index/impl/DefaultMultiFieldNotUniqueIndex.java
index 95c92dd..988fb16 100644
--- a/src/main/java/org/globsframework/metamodel/index/impl/DefaultMultiFieldNotUniqueIndex.java
+++ b/src/main/java/org/globsframework/metamodel/index/impl/DefaultMultiFieldNotUniqueIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.index.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.index.IndexVisitor;
import org.globsframework.metamodel.index.MultiFieldNotUniqueIndex;
diff --git a/src/main/java/org/globsframework/metamodel/index/impl/DefaultMultiFieldUniqueIndex.java b/src/main/java/org/globsframework/metamodel/index/impl/DefaultMultiFieldUniqueIndex.java
index 31c9c46..0ae1874 100644
--- a/src/main/java/org/globsframework/metamodel/index/impl/DefaultMultiFieldUniqueIndex.java
+++ b/src/main/java/org/globsframework/metamodel/index/impl/DefaultMultiFieldUniqueIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.index.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.index.IndexVisitor;
import org.globsframework.metamodel.index.MultiFieldUniqueIndex;
diff --git a/src/main/java/org/globsframework/metamodel/index/impl/DefaultNotUniqueIndex.java b/src/main/java/org/globsframework/metamodel/index/impl/DefaultNotUniqueIndex.java
index 7d4a7c0..66b72e8 100644
--- a/src/main/java/org/globsframework/metamodel/index/impl/DefaultNotUniqueIndex.java
+++ b/src/main/java/org/globsframework/metamodel/index/impl/DefaultNotUniqueIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.index.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.index.IndexVisitor;
import org.globsframework.metamodel.index.NotUniqueIndex;
diff --git a/src/main/java/org/globsframework/metamodel/index/impl/DefaultUniqueIndex.java b/src/main/java/org/globsframework/metamodel/index/impl/DefaultUniqueIndex.java
index 8b52997..0a00f60 100644
--- a/src/main/java/org/globsframework/metamodel/index/impl/DefaultUniqueIndex.java
+++ b/src/main/java/org/globsframework/metamodel/index/impl/DefaultUniqueIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.index.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.index.IndexVisitor;
import org.globsframework.metamodel.index.UniqueIndex;
diff --git a/src/main/java/org/globsframework/metamodel/links/DirectSingleLink.java b/src/main/java/org/globsframework/metamodel/links/DirectSingleLink.java
index 4980d66..14b225a 100644
--- a/src/main/java/org/globsframework/metamodel/links/DirectSingleLink.java
+++ b/src/main/java/org/globsframework/metamodel/links/DirectSingleLink.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.links;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
public interface DirectSingleLink extends DirectLink {
diff --git a/src/main/java/org/globsframework/metamodel/links/FieldMappingFunction.java b/src/main/java/org/globsframework/metamodel/links/FieldMappingFunction.java
index 211e1d2..1ed0e66 100644
--- a/src/main/java/org/globsframework/metamodel/links/FieldMappingFunction.java
+++ b/src/main/java/org/globsframework/metamodel/links/FieldMappingFunction.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.links;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
public interface FieldMappingFunction {
void process(Field sourceField, Field targetField);
diff --git a/src/main/java/org/globsframework/metamodel/links/Link.java b/src/main/java/org/globsframework/metamodel/links/Link.java
index 0edc195..b32682d 100644
--- a/src/main/java/org/globsframework/metamodel/links/Link.java
+++ b/src/main/java/org/globsframework/metamodel/links/Link.java
@@ -6,7 +6,7 @@
import org.globsframework.model.Key;
// introduce typeded link => containmentLink, 1->1, 1->N, M->N, ... hierarchical.
-public interface Link extends MutableAnnotations {
+public interface Link extends MutableAnnotations {
GlobType getSourceType();
diff --git a/src/main/java/org/globsframework/metamodel/links/impl/AbstractLink.java b/src/main/java/org/globsframework/metamodel/links/impl/AbstractLink.java
index aa37dbe..7289adf 100644
--- a/src/main/java/org/globsframework/metamodel/links/impl/AbstractLink.java
+++ b/src/main/java/org/globsframework/metamodel/links/impl/AbstractLink.java
@@ -5,7 +5,7 @@
import org.globsframework.metamodel.impl.DefaultAnnotations;
import org.globsframework.metamodel.links.Link;
-public abstract class AbstractLink extends DefaultAnnotations implements Link {
+public abstract class AbstractLink extends DefaultAnnotations implements Link {
private final String modelName;
private final String name;
diff --git a/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectLink.java b/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectLink.java
index 349f705..975a1c4 100644
--- a/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectLink.java
+++ b/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectLink.java
@@ -1,7 +1,7 @@
package org.globsframework.metamodel.links.impl;
import org.globsframework.metamodel.Annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.annotations.RequiredAnnotationType;
import org.globsframework.metamodel.links.DirectLink;
diff --git a/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectLinkBuilder.java b/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectLinkBuilder.java
index 0815583..00e5d03 100644
--- a/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectLinkBuilder.java
+++ b/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectLinkBuilder.java
@@ -2,6 +2,7 @@
import org.globsframework.metamodel.Annotations;
import org.globsframework.metamodel.MutableGlobLinkModel;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.links.DirectLink;
class DefaultDirectLinkBuilder extends DefaultLinkBuilder implements MutableGlobLinkModel.DirectLinkBuilder {
@@ -18,7 +19,7 @@ public DirectLink publish() {
return link;
}
- MutableGlobLinkModel.DirectLinkBuilder getT() {
+ DefaultDirectLinkBuilder getT() {
return this;
}
}
diff --git a/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectSingleLink.java b/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectSingleLink.java
index aad413d..1cd1f0a 100644
--- a/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectSingleLink.java
+++ b/src/main/java/org/globsframework/metamodel/links/impl/DefaultDirectSingleLink.java
@@ -1,7 +1,7 @@
package org.globsframework.metamodel.links.impl;
import org.globsframework.metamodel.Annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.annotations.RequiredAnnotationType;
import org.globsframework.metamodel.links.DirectSingleLink;
diff --git a/src/main/java/org/globsframework/metamodel/links/impl/DefaultLinkBuilder.java b/src/main/java/org/globsframework/metamodel/links/impl/DefaultLinkBuilder.java
index d027691..d3d00d9 100644
--- a/src/main/java/org/globsframework/metamodel/links/impl/DefaultLinkBuilder.java
+++ b/src/main/java/org/globsframework/metamodel/links/impl/DefaultLinkBuilder.java
@@ -1,7 +1,7 @@
package org.globsframework.metamodel.links.impl;
import org.globsframework.metamodel.Annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.MutableGlobLinkModel;
import org.globsframework.metamodel.impl.DefaultAnnotations;
@@ -14,8 +14,8 @@
import java.util.ArrayList;
import java.util.List;
-public abstract class DefaultLinkBuilder
- extends DefaultAnnotations implements MutableGlobLinkModel.LinkBuilder, MutableAnnotations {
+public abstract class DefaultLinkBuilder extends DefaultAnnotations
+ implements MutableGlobLinkModel.LinkBuilder, MutableAnnotations {
private final String modelName;
private final String name;
private final List> mappings = new ArrayList<>();
diff --git a/src/main/java/org/globsframework/metamodel/links/impl/DefaultMutableGlobLinkModel.java b/src/main/java/org/globsframework/metamodel/links/impl/DefaultMutableGlobLinkModel.java
index 45bed1d..fa1b7bf 100644
--- a/src/main/java/org/globsframework/metamodel/links/impl/DefaultMutableGlobLinkModel.java
+++ b/src/main/java/org/globsframework/metamodel/links/impl/DefaultMutableGlobLinkModel.java
@@ -3,6 +3,7 @@
import org.globsframework.metamodel.*;
import org.globsframework.metamodel.annotations.FieldNameAnnotationType;
import org.globsframework.metamodel.annotations.LinkModelNameAnnotationType;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.impl.DefaultAnnotations;
import org.globsframework.metamodel.links.DirectLink;
import org.globsframework.metamodel.links.FieldMappingFunction;
diff --git a/src/main/java/org/globsframework/metamodel/links/impl/UnInitializedLink.java b/src/main/java/org/globsframework/metamodel/links/impl/UnInitializedLink.java
index 7184bd9..fa1793a 100644
--- a/src/main/java/org/globsframework/metamodel/links/impl/UnInitializedLink.java
+++ b/src/main/java/org/globsframework/metamodel/links/impl/UnInitializedLink.java
@@ -1,7 +1,7 @@
package org.globsframework.metamodel.links.impl;
import org.globsframework.metamodel.Annotations;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.annotations.FieldNameAnnotationType;
import org.globsframework.metamodel.links.DirectSingleLink;
diff --git a/src/main/java/org/globsframework/metamodel/properties/Property.java b/src/main/java/org/globsframework/metamodel/properties/Property.java
deleted file mode 100644
index 142f3a1..0000000
--- a/src/main/java/org/globsframework/metamodel/properties/Property.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.globsframework.metamodel.properties;
-
-public interface Property {
-
- String getName();
-
- int getId();
-
- D createValue(T value);
-}
diff --git a/src/main/java/org/globsframework/metamodel/properties/PropertyHolder.java b/src/main/java/org/globsframework/metamodel/properties/PropertyHolder.java
deleted file mode 100644
index d45b70f..0000000
--- a/src/main/java/org/globsframework/metamodel/properties/PropertyHolder.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.globsframework.metamodel.properties;
-
-public interface PropertyHolder {
-
- // get return te default value if no value was set via key.createValue
- D getProperty(Property key);
-
- void updateProperty(Property key, D value);
-
-}
diff --git a/src/main/java/org/globsframework/metamodel/properties/PropertyProvider.java b/src/main/java/org/globsframework/metamodel/properties/PropertyProvider.java
deleted file mode 100644
index 68deb32..0000000
--- a/src/main/java/org/globsframework/metamodel/properties/PropertyProvider.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.globsframework.metamodel.properties;
-
-public interface PropertyProvider {
-}
diff --git a/src/main/java/org/globsframework/metamodel/properties/impl/AbstractDelegatePropertyHolder.java b/src/main/java/org/globsframework/metamodel/properties/impl/AbstractDelegatePropertyHolder.java
deleted file mode 100644
index ce4988f..0000000
--- a/src/main/java/org/globsframework/metamodel/properties/impl/AbstractDelegatePropertyHolder.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.globsframework.metamodel.properties.impl;
-
-import org.globsframework.metamodel.properties.Property;
-import org.globsframework.metamodel.properties.PropertyHolder;
-import org.globsframework.utils.exceptions.ItemNotFound;
-
-public interface AbstractDelegatePropertyHolder extends PropertyHolder {
- Object NULL_OBJECT = new Object();
-
- // must return from a volatile
- Object[] getProperties();
-
- // lock getValueOwner and
- void setProperties(Object[] properties);
-
- T getValueOwner();
-
- default D getProperty(Property key) throws ItemNotFound {
- Object[] currentProp = getProperties();
- int id = key.getId();
- if (id < currentProp.length) {
- Object value = currentProp[id];
- if (value != NULL_OBJECT) {
- return (D)value;
- }
- }
- return addDefaultProperty(key);
- }
-
- default void updateProperty(Property key, D value) {
- synchronized (this) {
- Object[] localProp = getProperties();
- if (key.getId() < localProp.length) {
- localProp[key.getId()] = value;
- return;
- }
- Object[] tmp = new Object[key.getId() + 2];
- int i;
- for (i = 0; i < localProp.length; i++) {
- tmp[i] = localProp[i];
- }
- for (; i < tmp.length; i++) {
- tmp[i] = NULL_OBJECT;
- }
- tmp[key.getId()] = value;
- setProperties(tmp);
- }
- }
-
- default D addDefaultProperty(Property key) {
- synchronized (this) {
- Object[] localProp = getProperties();
- if (key.getId() < localProp.length) {
- return getOrCreate(key, localProp, getValueOwner());
- }
- D value = key.createValue(getValueOwner());
- Object[] tmp = new Object[key.getId() + 2];
- int i;
- for (i = 0; i < localProp.length; i++) {
- tmp[i] = localProp[i];
- }
- for (; i < tmp.length; i++) {
- tmp[i] = NULL_OBJECT;
- }
- tmp[key.getId()] = value;
- setProperties(tmp);
- return value;
- }
- }
-
- static D getOrCreate(Property key, Object[] objects, final T owner) {
- Object value = objects[key.getId()];
- if (value == NULL_OBJECT) {
- value = key.createValue(owner);
- objects[key.getId()] = value;
- }
- return (D)value;
- }
-}
diff --git a/src/main/java/org/globsframework/metamodel/properties/impl/AbstractPropertyHolder.java b/src/main/java/org/globsframework/metamodel/properties/impl/AbstractPropertyHolder.java
deleted file mode 100644
index 0e53c86..0000000
--- a/src/main/java/org/globsframework/metamodel/properties/impl/AbstractPropertyHolder.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.globsframework.metamodel.properties.impl;
-
-public abstract class AbstractPropertyHolder implements AbstractDelegatePropertyHolder {
- private volatile Object[] properties = new Object[]{NULL_OBJECT, NULL_OBJECT};
-
- public Object[] getProperties() {
- return this.properties;
- }
-
- public void setProperties(Object[] properties) {
- this.properties = properties;
- }
-
-}
diff --git a/src/main/java/org/globsframework/metamodel/properties/impl/DelegatePropertyHolder.java b/src/main/java/org/globsframework/metamodel/properties/impl/DelegatePropertyHolder.java
deleted file mode 100644
index c06e83f..0000000
--- a/src/main/java/org/globsframework/metamodel/properties/impl/DelegatePropertyHolder.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.globsframework.metamodel.properties.impl;
-
-public class DelegatePropertyHolder extends AbstractPropertyHolder {
- private final T propertyOwner;
-
- public DelegatePropertyHolder(T propertyOwner) {
- this.propertyOwner = propertyOwner;
- }
-
- public T getValueOwner() {
- return propertyOwner;
- }
-}
diff --git a/src/main/java/org/globsframework/metamodel/properties/impl/InheritedPropertyHolder.java b/src/main/java/org/globsframework/metamodel/properties/impl/InheritedPropertyHolder.java
deleted file mode 100644
index 273c476..0000000
--- a/src/main/java/org/globsframework/metamodel/properties/impl/InheritedPropertyHolder.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.globsframework.metamodel.properties.impl;
-
-public abstract class InheritedPropertyHolder extends AbstractPropertyHolder {
-
- public T getValueOwner() {
- return (T)this;
- }
-}
diff --git a/src/main/java/org/globsframework/metamodel/properties/impl/PropertiesBuilder.java b/src/main/java/org/globsframework/metamodel/properties/impl/PropertiesBuilder.java
deleted file mode 100644
index bb540ae..0000000
--- a/src/main/java/org/globsframework/metamodel/properties/impl/PropertiesBuilder.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.globsframework.metamodel.properties.impl;
-
-import org.globsframework.metamodel.properties.Property;
-import org.globsframework.metamodel.utils.IdProperty;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class PropertiesBuilder {
- private AtomicInteger id = new AtomicInteger(0);
-
- public interface PropertyBuilder {
- D createValue(T value);
- }
-
- public Property createProperty(String name, PropertyBuilder function) {
- return new IdProperty(name, id.getAndIncrement()) {
- public D createValue(T value) {
- return function.createValue(value);
- }
- };
- }
-}
diff --git a/src/main/java/org/globsframework/metamodel/utils/AnnotatedPropertyHolder.java b/src/main/java/org/globsframework/metamodel/utils/AnnotatedPropertyHolder.java
deleted file mode 100644
index 2686cea..0000000
--- a/src/main/java/org/globsframework/metamodel/utils/AnnotatedPropertyHolder.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.globsframework.metamodel.utils;
-
-import org.globsframework.metamodel.Annotations;
-import org.globsframework.metamodel.impl.DefaultAnnotations;
-import org.globsframework.metamodel.properties.impl.AbstractPropertyHolder;
-import org.globsframework.model.Glob;
-import org.globsframework.model.Key;
-
-public abstract class AnnotatedPropertyHolder extends AbstractPropertyHolder implements Annotations {
- private Annotations annotations = new DefaultAnnotations();
-
- public boolean hasAnnotation(Key annotation) {
- return annotations.hasAnnotation(annotation);
- }
-
- public Glob getAnnotation(Key key) {
- return annotations.getAnnotation(key);
- }
-
- public Glob findAnnotation(Key key) {
- return annotations.findAnnotation(key);
- }
-}
diff --git a/src/main/java/org/globsframework/metamodel/utils/GlobTypeDependencies.java b/src/main/java/org/globsframework/metamodel/utils/GlobTypeDependencies.java
index 40a4611..4a2eb7e 100644
--- a/src/main/java/org/globsframework/metamodel/utils/GlobTypeDependencies.java
+++ b/src/main/java/org/globsframework/metamodel/utils/GlobTypeDependencies.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.links.Link;
import org.globsframework.metamodel.links.impl.DefaultMutableGlobLinkModel;
diff --git a/src/main/java/org/globsframework/metamodel/utils/GlobTypeUtils.java b/src/main/java/org/globsframework/metamodel/utils/GlobTypeUtils.java
index afe8025..92a1833 100644
--- a/src/main/java/org/globsframework/metamodel/utils/GlobTypeUtils.java
+++ b/src/main/java/org/globsframework/metamodel/utils/GlobTypeUtils.java
@@ -1,6 +1,6 @@
package org.globsframework.metamodel.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.annotations.FieldNameAnnotationType;
import org.globsframework.metamodel.annotations.NamingFieldAnnotationType;
diff --git a/src/main/java/org/globsframework/metamodel/utils/IdProperty.java b/src/main/java/org/globsframework/metamodel/utils/IdProperty.java
deleted file mode 100644
index 19e1360..0000000
--- a/src/main/java/org/globsframework/metamodel/utils/IdProperty.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.globsframework.metamodel.utils;
-
-import org.globsframework.metamodel.properties.Property;
-
-public abstract class IdProperty implements Property {
- private String name;
- private int id;
-
- public IdProperty(String name, int id) {
- this.name = name;
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public int getId() {
- return id;
- }
-}
diff --git a/src/main/java/org/globsframework/metamodel/utils/MutableAnnotations.java b/src/main/java/org/globsframework/metamodel/utils/MutableAnnotations.java
index b2de557..54d0143 100644
--- a/src/main/java/org/globsframework/metamodel/utils/MutableAnnotations.java
+++ b/src/main/java/org/globsframework/metamodel/utils/MutableAnnotations.java
@@ -5,9 +5,9 @@
import java.util.stream.Stream;
-public interface MutableAnnotations extends Annotations {
+public interface MutableAnnotations extends Annotations {
- T addAnnotation(Glob glob);
+ MutableAnnotations addAnnotation(Glob glob);
- T addAnnotations(Stream globs);
+ MutableAnnotations addAnnotations(Stream globs);
}
diff --git a/src/main/java/org/globsframework/model/AbstractKey.java b/src/main/java/org/globsframework/model/AbstractKey.java
index f45672e..e1a35f9 100644
--- a/src/main/java/org/globsframework/model/AbstractKey.java
+++ b/src/main/java/org/globsframework/model/AbstractKey.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.impl.AbstractFieldValues;
import org.globsframework.model.utils.FieldCheck;
diff --git a/src/main/java/org/globsframework/model/ChangeSet.java b/src/main/java/org/globsframework/model/ChangeSet.java
index 45a5991..7621bec 100644
--- a/src/main/java/org/globsframework/model/ChangeSet.java
+++ b/src/main/java/org/globsframework/model/ChangeSet.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import java.util.Set;
diff --git a/src/main/java/org/globsframework/model/FieldSetter.java b/src/main/java/org/globsframework/model/FieldSetter.java
index e9f9f65..3631764 100644
--- a/src/main/java/org/globsframework/model/FieldSetter.java
+++ b/src/main/java/org/globsframework/model/FieldSetter.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.utils.exceptions.ItemNotFound;
diff --git a/src/main/java/org/globsframework/model/FieldValue.java b/src/main/java/org/globsframework/model/FieldValue.java
index 4c2d71b..7ddf1e4 100644
--- a/src/main/java/org/globsframework/model/FieldValue.java
+++ b/src/main/java/org/globsframework/model/FieldValue.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
public class FieldValue {
diff --git a/src/main/java/org/globsframework/model/FieldValues.java b/src/main/java/org/globsframework/model/FieldValues.java
index a4eb886..8cbab75 100644
--- a/src/main/java/org/globsframework/model/FieldValues.java
+++ b/src/main/java/org/globsframework/model/FieldValues.java
@@ -1,15 +1,12 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
-import org.globsframework.model.format.GlobPrinter;
import org.globsframework.utils.exceptions.ItemNotFound;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.ZonedDateTime;
-import java.util.Optional;
-import java.util.function.Function;
public interface FieldValues extends FieldValuesAccessor, FieldsValueScanner {
diff --git a/src/main/java/org/globsframework/model/FieldValuesAccessor.java b/src/main/java/org/globsframework/model/FieldValuesAccessor.java
index 2130072..01ee582 100644
--- a/src/main/java/org/globsframework/model/FieldValuesAccessor.java
+++ b/src/main/java/org/globsframework/model/FieldValuesAccessor.java
@@ -1,8 +1,7 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
-import org.globsframework.model.format.GlobPrinter;
import org.globsframework.utils.Strings;
import org.globsframework.utils.exceptions.ItemNotFound;
diff --git a/src/main/java/org/globsframework/model/FieldValuesBuilder.java b/src/main/java/org/globsframework/model/FieldValuesBuilder.java
index 77b8945..cf0d24b 100644
--- a/src/main/java/org/globsframework/model/FieldValuesBuilder.java
+++ b/src/main/java/org/globsframework/model/FieldValuesBuilder.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.utils.DefaultFieldValues;
diff --git a/src/main/java/org/globsframework/model/FieldValuesButKey.java b/src/main/java/org/globsframework/model/FieldValuesButKey.java
index ace1542..a344c7e 100644
--- a/src/main/java/org/globsframework/model/FieldValuesButKey.java
+++ b/src/main/java/org/globsframework/model/FieldValuesButKey.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.utils.exceptions.ItemNotFound;
diff --git a/src/main/java/org/globsframework/model/FieldValuesWithPrevious.java b/src/main/java/org/globsframework/model/FieldValuesWithPrevious.java
index 8aea653..e5c32ba 100644
--- a/src/main/java/org/globsframework/model/FieldValuesWithPrevious.java
+++ b/src/main/java/org/globsframework/model/FieldValuesWithPrevious.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.utils.exceptions.ItemNotFound;
diff --git a/src/main/java/org/globsframework/model/FieldValuesWithPreviousBuilder.java b/src/main/java/org/globsframework/model/FieldValuesWithPreviousBuilder.java
index 2bbee5b..ca4f009 100644
--- a/src/main/java/org/globsframework/model/FieldValuesWithPreviousBuilder.java
+++ b/src/main/java/org/globsframework/model/FieldValuesWithPreviousBuilder.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.utils.DefaultFieldValuesWithPrevious;
diff --git a/src/main/java/org/globsframework/model/FieldsValueScanner.java b/src/main/java/org/globsframework/model/FieldsValueScanner.java
index 5ad1bef..97adf7b 100644
--- a/src/main/java/org/globsframework/model/FieldsValueScanner.java
+++ b/src/main/java/org/globsframework/model/FieldsValueScanner.java
@@ -1,10 +1,8 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.FieldValueVisitor;
-import java.util.Optional;
-
public interface FieldsValueScanner {
static FieldsValueScanner from(FieldValue[] fieldValues) {
return new FieldsValueScanner() {
diff --git a/src/main/java/org/globsframework/model/FieldsValueWithPreviousScanner.java b/src/main/java/org/globsframework/model/FieldsValueWithPreviousScanner.java
index 2dbcd24..6a3816f 100644
--- a/src/main/java/org/globsframework/model/FieldsValueWithPreviousScanner.java
+++ b/src/main/java/org/globsframework/model/FieldsValueWithPreviousScanner.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.FieldValueVisitor;
public interface FieldsValueWithPreviousScanner extends FieldsValueScanner {
diff --git a/src/main/java/org/globsframework/model/GlobFactory.java b/src/main/java/org/globsframework/model/GlobFactory.java
index 222e5c6..03a5882 100644
--- a/src/main/java/org/globsframework/model/GlobFactory.java
+++ b/src/main/java/org/globsframework/model/GlobFactory.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.globaccessor.get.*;
import org.globsframework.model.globaccessor.set.GlobSetAccessor;
diff --git a/src/main/java/org/globsframework/model/GlobList.java b/src/main/java/org/globsframework/model/GlobList.java
index d2fa263..740d627 100644
--- a/src/main/java/org/globsframework/model/GlobList.java
+++ b/src/main/java/org/globsframework/model/GlobList.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.BooleanField;
import org.globsframework.metamodel.fields.DoubleField;
diff --git a/src/main/java/org/globsframework/model/GlobRepository.java b/src/main/java/org/globsframework/model/GlobRepository.java
index aa93cb7..415f15d 100644
--- a/src/main/java/org/globsframework/model/GlobRepository.java
+++ b/src/main/java/org/globsframework/model/GlobRepository.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.links.Link;
import org.globsframework.model.repository.GlobIdGenerator;
diff --git a/src/main/java/org/globsframework/model/KeyBuilder.java b/src/main/java/org/globsframework/model/KeyBuilder.java
index 6c7832f..e1dd040 100644
--- a/src/main/java/org/globsframework/model/KeyBuilder.java
+++ b/src/main/java/org/globsframework/model/KeyBuilder.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.impl.*;
@@ -59,10 +59,13 @@ public static KeyBuilder init(Field field, int value) {
}
public static Key newKey(GlobType type, Object value) throws InvalidParameter {
- return new SingleFieldKey(type, value);
+ return newKey(SingleFieldKey.getKeyField(type), value);
}
public static Key newKey(Field field, Object value) throws InvalidParameter {
+ if (field instanceof LongField) {
+ return new LongKeyField(field, (Long) value);
+ }
return new SingleFieldKey(field, value);
}
@@ -212,7 +215,10 @@ private static Key createSingle(GlobType type, Field field, boolean present, Obj
throw new MissingInfo("Field '" + field.getName() +
"' missing for identifying a Glob of type: " + type.getName());
}
- return newKey(type, value);
+ if (field instanceof LongField) {
+ return new LongKeyField(field, (Long) value);
+ }
+ return new SingleFieldKey(field, value);
}
private static Key createKey(GlobType type, FieldValueGetter getter) throws MissingInfo {
diff --git a/src/main/java/org/globsframework/model/MutableGlob.java b/src/main/java/org/globsframework/model/MutableGlob.java
index 34f9ea0..e69cf33 100644
--- a/src/main/java/org/globsframework/model/MutableGlob.java
+++ b/src/main/java/org/globsframework/model/MutableGlob.java
@@ -1,7 +1,7 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
public interface MutableGlob extends Glob, FieldSetter {
MutableGlob unset(Field field);
diff --git a/src/main/java/org/globsframework/model/ReadOnlyGlobRepository.java b/src/main/java/org/globsframework/model/ReadOnlyGlobRepository.java
index 1209a0f..df6afa0 100644
--- a/src/main/java/org/globsframework/model/ReadOnlyGlobRepository.java
+++ b/src/main/java/org/globsframework/model/ReadOnlyGlobRepository.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.index.MultiFieldIndex;
import org.globsframework.metamodel.index.SingleFieldIndex;
diff --git a/src/main/java/org/globsframework/model/delta/DefaultChangeSet.java b/src/main/java/org/globsframework/model/delta/DefaultChangeSet.java
index ed30af3..c9e0e7d 100644
--- a/src/main/java/org/globsframework/model/delta/DefaultChangeSet.java
+++ b/src/main/java/org/globsframework/model/delta/DefaultChangeSet.java
@@ -1,6 +1,6 @@
package org.globsframework.model.delta;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.*;
import org.globsframework.model.utils.BreakException;
diff --git a/src/main/java/org/globsframework/model/delta/DefaultDeltaGlob.java b/src/main/java/org/globsframework/model/delta/DefaultDeltaGlob.java
index fcfc3eb..d6eb708 100644
--- a/src/main/java/org/globsframework/model/delta/DefaultDeltaGlob.java
+++ b/src/main/java/org/globsframework/model/delta/DefaultDeltaGlob.java
@@ -1,6 +1,6 @@
package org.globsframework.model.delta;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.*;
diff --git a/src/main/java/org/globsframework/model/delta/DeltaFieldValuesFromArray.java b/src/main/java/org/globsframework/model/delta/DeltaFieldValuesFromArray.java
index f4272b6..4ad14f1 100644
--- a/src/main/java/org/globsframework/model/delta/DeltaFieldValuesFromArray.java
+++ b/src/main/java/org/globsframework/model/delta/DeltaFieldValuesFromArray.java
@@ -1,6 +1,6 @@
package org.globsframework.model.delta;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValue;
diff --git a/src/main/java/org/globsframework/model/delta/DeltaGlob.java b/src/main/java/org/globsframework/model/delta/DeltaGlob.java
index f5bdf70..074ae02 100644
--- a/src/main/java/org/globsframework/model/delta/DeltaGlob.java
+++ b/src/main/java/org/globsframework/model/delta/DeltaGlob.java
@@ -1,6 +1,6 @@
package org.globsframework.model.delta;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.*;
public interface DeltaGlob extends FieldValuesWithPrevious {
diff --git a/src/main/java/org/globsframework/model/delta/DeltaState.java b/src/main/java/org/globsframework/model/delta/DeltaState.java
index 18b898a..4b6bdec 100644
--- a/src/main/java/org/globsframework/model/delta/DeltaState.java
+++ b/src/main/java/org/globsframework/model/delta/DeltaState.java
@@ -1,6 +1,6 @@
package org.globsframework.model.delta;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.ChangeSetVisitor;
import org.globsframework.model.FieldsValueScanner;
import org.globsframework.utils.Unset;
diff --git a/src/main/java/org/globsframework/model/delta/InDepthChangeSet.java b/src/main/java/org/globsframework/model/delta/InDepthChangeSet.java
index 0fe97cb..13d4183 100644
--- a/src/main/java/org/globsframework/model/delta/InDepthChangeSet.java
+++ b/src/main/java/org/globsframework/model/delta/InDepthChangeSet.java
@@ -1,6 +1,6 @@
package org.globsframework.model.delta;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.*;
diff --git a/src/main/java/org/globsframework/model/delta/MutableChangeSet.java b/src/main/java/org/globsframework/model/delta/MutableChangeSet.java
index f8e3132..75822ff 100644
--- a/src/main/java/org/globsframework/model/delta/MutableChangeSet.java
+++ b/src/main/java/org/globsframework/model/delta/MutableChangeSet.java
@@ -1,6 +1,6 @@
package org.globsframework.model.delta;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.*;
import org.globsframework.utils.exceptions.InvalidState;
diff --git a/src/main/java/org/globsframework/model/format/GlobPrinter.java b/src/main/java/org/globsframework/model/format/GlobPrinter.java
index ce49fe6..6574f20 100644
--- a/src/main/java/org/globsframework/model/format/GlobPrinter.java
+++ b/src/main/java/org/globsframework/model/format/GlobPrinter.java
@@ -1,6 +1,6 @@
package org.globsframework.model.format;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.GlobArrayField;
import org.globsframework.metamodel.fields.GlobArrayUnionField;
diff --git a/src/main/java/org/globsframework/model/impl/AbstractDefaultGlob.java b/src/main/java/org/globsframework/model/impl/AbstractDefaultGlob.java
index 5eda1fe..117ef8c 100644
--- a/src/main/java/org/globsframework/model/impl/AbstractDefaultGlob.java
+++ b/src/main/java/org/globsframework/model/impl/AbstractDefaultGlob.java
@@ -1,27 +1,23 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValues;
import org.globsframework.model.MutableGlob;
import org.globsframework.utils.exceptions.ItemNotFound;
-import java.util.BitSet;
-
public abstract class AbstractDefaultGlob extends AbstractMutableGlob {
protected final GlobType type;
- protected final BitSet isSet;
protected final Object[] values;
protected AbstractDefaultGlob(GlobType type) {
- this(type, new Object[type.getFieldCount()], new BitSet(type.getFieldCount()));
+ this(type, new Object[type.getFieldCount()]);
}
- public AbstractDefaultGlob(GlobType type, Object[] values, BitSet isSet) {
+ public AbstractDefaultGlob(GlobType type, Object[] values) {
this.type = type;
this.values = values;
- this.isSet = isSet;
}
public GlobType getType() {
@@ -54,23 +50,24 @@ public Object doGet(Field field) {
public MutableGlob doSet(Field field, Object value) {
int index = field.getIndex();
values[index] = value;
- isSet.set(index);
+ setSetAt(index);
return this;
}
public boolean isSet(Field field) throws ItemNotFound {
- return isSet.get(field.getIndex());
+ final int index = field.getIndex();
+ return isSetAt(index);
}
+ abstract public void setSetAt(int index);
+
+ abstract public boolean isSetAt(int index);
+
+ abstract public void clearSetAt(int index);
+
public MutableGlob unset(Field field) {
values[field.getIndex()] = null;
- isSet.clear(field.getIndex());
+ clearSetAt(field.getIndex());
return this;
}
-
- Object[] duplicateValues() {
- Object[] newValues = new Object[values.length];
- System.arraycopy(values, 0, newValues, 0, values.length);
- return newValues;
- }
}
diff --git a/src/main/java/org/globsframework/model/impl/AbstractFieldValues.java b/src/main/java/org/globsframework/model/impl/AbstractFieldValues.java
index 4d41e03..7a60a0a 100644
--- a/src/main/java/org/globsframework/model/impl/AbstractFieldValues.java
+++ b/src/main/java/org/globsframework/model/impl/AbstractFieldValues.java
@@ -1,6 +1,6 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.FieldValues;
import org.globsframework.model.Glob;
diff --git a/src/main/java/org/globsframework/model/impl/AbstractFieldValuesWithPrevious.java b/src/main/java/org/globsframework/model/impl/AbstractFieldValuesWithPrevious.java
index b282db5..9de7edc 100644
--- a/src/main/java/org/globsframework/model/impl/AbstractFieldValuesWithPrevious.java
+++ b/src/main/java/org/globsframework/model/impl/AbstractFieldValuesWithPrevious.java
@@ -1,6 +1,6 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.FieldValuesWithPrevious;
import org.globsframework.model.Glob;
diff --git a/src/main/java/org/globsframework/model/impl/AbstractGlob.java b/src/main/java/org/globsframework/model/impl/AbstractGlob.java
index b24da44..ea268ed 100644
--- a/src/main/java/org/globsframework/model/impl/AbstractGlob.java
+++ b/src/main/java/org/globsframework/model/impl/AbstractGlob.java
@@ -1,13 +1,12 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.*;
import org.globsframework.utils.exceptions.ItemNotFound;
public abstract class AbstractGlob extends AbstractFieldValues implements Glob, Key {
- protected int hashCode;
public abstract GlobType getType();
@@ -163,22 +162,6 @@ public GlobType getGlobType() {
return getType();
}
- public int hashCode() {
- if (hashCode != 0) {
- return hashCode;
- }
- int hashCode = getType().hashCode();
- for (Field keyField : getType().getKeyFields()) {
- Object value = getValue(keyField);
- hashCode = 31 * hashCode + (value != null ? keyField.valueHash(value) : 0);
- }
- if (hashCode == 0) {
- hashCode = 31;
- }
- this.hashCode = hashCode;
- return hashCode;
- }
-
public boolean equals(Object o) {
if (this == o) {
return true;
diff --git a/src/main/java/org/globsframework/model/impl/AbstractMutableGlob.java b/src/main/java/org/globsframework/model/impl/AbstractMutableGlob.java
index 9353de7..2d02cc4 100644
--- a/src/main/java/org/globsframework/model/impl/AbstractMutableGlob.java
+++ b/src/main/java/org/globsframework/model/impl/AbstractMutableGlob.java
@@ -1,6 +1,6 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.metamodel.links.Link;
import org.globsframework.model.*;
@@ -154,7 +154,7 @@ public Object doCheckedGet(Field field) {
public MutableGlob setObject(Field field, Object value){
if (FieldCheck.CheckGlob.shouldCheck) {
- if (hashCode != 0 && field.isKeyField()) {
+ if (isHashComputed() && field.isKeyField()) {
throw new RuntimeException(field.getFullName() + " is a key value and the hashCode is already computed.");
}
FieldCheck.check(field, getType(), value);
@@ -162,6 +162,8 @@ public MutableGlob setObject(Field field, Object value){
return doSet(field, value);
}
+ abstract public boolean isHashComputed();
+
abstract public MutableGlob doSet(Field field, Object value);
public Key getKey() {
diff --git a/src/main/java/org/globsframework/model/impl/CompositeKey.java b/src/main/java/org/globsframework/model/impl/CompositeKey.java
index bb87b67..3011aea 100644
--- a/src/main/java/org/globsframework/model/impl/CompositeKey.java
+++ b/src/main/java/org/globsframework/model/impl/CompositeKey.java
@@ -1,6 +1,6 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.AbstractKey;
import org.globsframework.model.FieldValue;
diff --git a/src/main/java/org/globsframework/model/impl/DefaultGlob.java b/src/main/java/org/globsframework/model/impl/DefaultGlob.java
index 843e110..5254953 100644
--- a/src/main/java/org/globsframework/model/impl/DefaultGlob.java
+++ b/src/main/java/org/globsframework/model/impl/DefaultGlob.java
@@ -1,17 +1,49 @@
package org.globsframework.model.impl;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
-import org.globsframework.model.MutableGlob;
import java.util.BitSet;
public class DefaultGlob extends AbstractDefaultGlob {
+ protected int hashCode;
+ protected final BitSet isSet;
public DefaultGlob(GlobType type) {
super(type);
+ isSet = new BitSet(type.getFieldCount());
}
- private DefaultGlob(GlobType type, Object[] values, BitSet bitSet) {
- super(type, values, bitSet);
+ public void setSetAt(int index) {
+ isSet.set(index);
}
+
+ public boolean isSetAt(int index) {
+ return isSet.get(index);
+ }
+
+ public void clearSetAt(int index) {
+ isSet.clear(index);
+ }
+
+ public int hashCode() {
+ if (hashCode != 0) {
+ return hashCode;
+ }
+ int hashCode = getType().hashCode();
+ for (Field keyField : getType().getKeyFields()) {
+ Object value = getValue(keyField);
+ hashCode = 31 * hashCode + (value != null ? keyField.valueHash(value) : 0);
+ }
+ if (hashCode == 0) {
+ hashCode = 31;
+ }
+ this.hashCode = hashCode;
+ return hashCode;
+ }
+
+ public boolean isHashComputed() {
+ return hashCode != 0;
+ }
+
}
diff --git a/src/main/java/org/globsframework/model/impl/DefaultGlob128.java b/src/main/java/org/globsframework/model/impl/DefaultGlob128.java
new file mode 100644
index 0000000..30db7c8
--- /dev/null
+++ b/src/main/java/org/globsframework/model/impl/DefaultGlob128.java
@@ -0,0 +1,68 @@
+package org.globsframework.model.impl;
+
+import org.globsframework.metamodel.fields.Field;
+import org.globsframework.metamodel.GlobType;
+
+public class DefaultGlob128 extends AbstractDefaultGlob {
+ protected int hashCode;
+ private long set1;
+ private long set2;
+
+ public DefaultGlob128(GlobType type) {
+ super(type);
+ }
+
+ public void setSetAt(int index) {
+ if (index < 64) {
+ set1 |= (1L << index);
+ } else if (index < 128) {
+ set2 |= (1L << (index - 64));
+ }
+ else {
+ throw new RuntimeException("index out of range " + index);
+ }
+ }
+
+ public boolean isSetAt(int index) {
+ if (index < 64) {
+ return (set1 & (1L << index)) != 0;
+ } else if (index < 128) {
+ return (set2 & (1L << (index - 64))) != 0;
+ }
+ else {
+ throw new RuntimeException("index out of range " + index);
+ }
+ }
+
+ public void clearSetAt(int index) {
+ if (index < 64) {
+ set1 &= ~(1L << index);
+ } else if (index < 128) {
+ set2 &= ~(1L << (index - 64));
+ }
+ else {
+ throw new RuntimeException("index out of range " + index);
+ }
+ }
+
+ public int hashCode() {
+ if (hashCode != 0) {
+ return hashCode;
+ }
+ int hashCode = getType().hashCode();
+ for (Field keyField : getType().getKeyFields()) {
+ Object value = getValue(keyField);
+ hashCode = 31 * hashCode + (value != null ? keyField.valueHash(value) : 0);
+ }
+ if (hashCode == 0) {
+ hashCode = 31;
+ }
+ this.hashCode = hashCode;
+ return hashCode;
+ }
+
+ public boolean isHashComputed() {
+ return hashCode != 0;
+ }
+
+}
diff --git a/src/main/java/org/globsframework/model/impl/DefaultGlob64.java b/src/main/java/org/globsframework/model/impl/DefaultGlob64.java
new file mode 100644
index 0000000..5b45e2c
--- /dev/null
+++ b/src/main/java/org/globsframework/model/impl/DefaultGlob64.java
@@ -0,0 +1,46 @@
+package org.globsframework.model.impl;
+
+import org.globsframework.metamodel.fields.Field;
+import org.globsframework.metamodel.GlobType;
+
+public class DefaultGlob64 extends AbstractDefaultGlob {
+ protected int hashCode;
+ private long set;
+
+ public DefaultGlob64(GlobType type) {
+ super(type);
+ }
+
+ public void setSetAt(int index) {
+ set |= (1L << index);
+ }
+
+ public boolean isSetAt(int index) {
+ return (set & (1L << index)) != 0;
+ }
+
+ public void clearSetAt(int index) {
+ set &= ~(1L << index);
+ }
+
+ public int hashCode() {
+ if (hashCode != 0) {
+ return hashCode;
+ }
+ int hashCode = getType().hashCode();
+ for (Field keyField : getType().getKeyFields()) {
+ Object value = getValue(keyField);
+ hashCode = 31 * hashCode + (value != null ? keyField.valueHash(value) : 0);
+ }
+ if (hashCode == 0) {
+ hashCode = 31;
+ }
+ this.hashCode = hashCode;
+ return hashCode;
+ }
+
+ public boolean isHashComputed() {
+ return hashCode != 0;
+ }
+
+}
diff --git a/src/main/java/org/globsframework/model/impl/EmptyKey.java b/src/main/java/org/globsframework/model/impl/EmptyKey.java
index b3d27fe..b979290 100644
--- a/src/main/java/org/globsframework/model/impl/EmptyKey.java
+++ b/src/main/java/org/globsframework/model/impl/EmptyKey.java
@@ -1,6 +1,6 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.FieldValue;
diff --git a/src/main/java/org/globsframework/model/impl/FourFieldKey.java b/src/main/java/org/globsframework/model/impl/FourFieldKey.java
index f5ad771..ad15666 100644
--- a/src/main/java/org/globsframework/model/impl/FourFieldKey.java
+++ b/src/main/java/org/globsframework/model/impl/FourFieldKey.java
@@ -1,6 +1,6 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.AbstractKey;
import org.globsframework.model.FieldValue;
diff --git a/src/main/java/org/globsframework/model/impl/LongKeyField.java b/src/main/java/org/globsframework/model/impl/LongKeyField.java
new file mode 100644
index 0000000..85de2e8
--- /dev/null
+++ b/src/main/java/org/globsframework/model/impl/LongKeyField.java
@@ -0,0 +1,121 @@
+package org.globsframework.model.impl;
+
+import org.globsframework.metamodel.fields.Field;
+import org.globsframework.metamodel.GlobType;
+import org.globsframework.model.*;
+import org.globsframework.model.utils.FieldCheck;
+import org.globsframework.utils.exceptions.InvalidParameter;
+import org.globsframework.utils.exceptions.ItemNotFound;
+
+public class LongKeyField extends AbstractKey {
+ private boolean isNull = true;
+ private final Field keyField;
+ private long value;
+
+ public LongKeyField(Field keyField) {
+ this.keyField = keyField;
+ }
+
+ public LongKeyField(Field keyField, boolean isNull, long value) {
+ this.keyField = keyField;
+ this.isNull = isNull;
+ this.value = value;
+ }
+
+ public LongKeyField(Field field, Long value) {
+ this.keyField = field;
+ this.isNull = value == null;
+ this.value = value == null ? 0 : value;
+ }
+
+ public GlobType getGlobType() {
+ return keyField.getGlobType();
+ }
+
+ public
+ T apply(T functor) throws Exception {
+ functor.process(keyField, isNull ? null : value);
+ return functor;
+ }
+
+ public int size() {
+ return 1;
+ }
+
+ // optimized - do not use generated code
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null) {
+ return false;
+ }
+ if (o.getClass().equals(LongKeyField.class)) {
+ LongKeyField otherSingleFieldKey = (LongKeyField) o;
+ return otherSingleFieldKey.getGlobType() == keyField.getGlobType() &&
+ (!otherSingleFieldKey.isNull && !isNull) ? keyField.valueEqual(otherSingleFieldKey.value, value) :
+ otherSingleFieldKey.isNull && isNull ;
+ }
+
+ if (!Key.class.isAssignableFrom(o.getClass())) {
+ return false;
+ }
+ Key otherKey = (Key) o;
+ return keyField.getGlobType() == otherKey.getGlobType()
+ && keyField.valueEqual(isNull ? null : value, otherKey.getValue(keyField));
+ }
+
+ // optimized - do not use generated code
+ public int hashCode() {
+ return computeHash();
+ }
+
+ private int computeHash() {
+ int hash = getGlobType().hashCode();
+ hash = 31 * hash + (isNull ? 0 : Long.hashCode(value));
+ if (hash == 0) {
+ hash = 31;
+ }
+ return hash;
+ }
+
+ public FieldValue[] toArray() {
+ return new FieldValue[]{
+ new FieldValue(keyField, isNull ? null : value),
+ };
+ }
+
+ public String toString() {
+ return getGlobType().getName() + "[" + keyField.getName() + "=" + (isNull ? "null" : value) + "]";
+ }
+
+ protected Object doGetValue(Field field) {
+ if (field.getKeyIndex() == 0) {
+ return isNull ? null : value;
+ }
+ throw new InvalidParameter(field + " is not a key field");
+ }
+
+ public MutableKey setValue(Field field, Object value) throws ItemNotFound {
+ FieldCheck.checkIsKeyOf(field, getGlobType());
+ isNull = value == null;
+ this.value = value == null ? 0 : (long) value;
+ return this;
+ }
+
+ public void reset() {
+ isNull = true;
+ this.value = 0;
+ }
+
+ public MutableKey duplicateKey() {
+ return new LongKeyField(keyField, isNull, value);
+ }
+
+ /*
+ On considere qu'une clé doit toujours avoir tous ses champs valorisé (au pire a null).
+ */
+ public boolean isSet(Field field) throws ItemNotFound {
+ return true;
+ }
+}
diff --git a/src/main/java/org/globsframework/model/impl/SingleFieldKey.java b/src/main/java/org/globsframework/model/impl/SingleFieldKey.java
index 215fb49..2e44e82 100644
--- a/src/main/java/org/globsframework/model/impl/SingleFieldKey.java
+++ b/src/main/java/org/globsframework/model/impl/SingleFieldKey.java
@@ -1,10 +1,9 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.*;
import org.globsframework.model.utils.FieldCheck;
-import org.globsframework.utils.Utils;
import org.globsframework.utils.exceptions.InvalidParameter;
import org.globsframework.utils.exceptions.ItemNotFound;
import org.globsframework.utils.exceptions.MissingInfo;
@@ -31,7 +30,7 @@ public SingleFieldKey(GlobType type, Object value) throws InvalidParameter {
this(getKeyField(type), value);
}
- private static Field getKeyField(GlobType type) throws InvalidParameter {
+ public static Field getKeyField(GlobType type) throws InvalidParameter {
Field[] keyFields = type.getKeyFields();
if (keyFields.length != 1) {
throw new InvalidParameter("Cannot use a single field key for type " + type + " - " +
diff --git a/src/main/java/org/globsframework/model/impl/ThreeFieldKey.java b/src/main/java/org/globsframework/model/impl/ThreeFieldKey.java
index 53b8813..59b1922 100644
--- a/src/main/java/org/globsframework/model/impl/ThreeFieldKey.java
+++ b/src/main/java/org/globsframework/model/impl/ThreeFieldKey.java
@@ -1,6 +1,6 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.AbstractKey;
import org.globsframework.model.FieldValue;
diff --git a/src/main/java/org/globsframework/model/impl/TwoFieldKey.java b/src/main/java/org/globsframework/model/impl/TwoFieldKey.java
index c6abb36..00fa3fe 100644
--- a/src/main/java/org/globsframework/model/impl/TwoFieldKey.java
+++ b/src/main/java/org/globsframework/model/impl/TwoFieldKey.java
@@ -1,13 +1,12 @@
package org.globsframework.model.impl;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.AbstractKey;
import org.globsframework.model.FieldValue;
import org.globsframework.model.Key;
import org.globsframework.model.MutableKey;
import org.globsframework.model.utils.FieldCheck;
-import org.globsframework.utils.Utils;
import org.globsframework.utils.exceptions.InvalidParameter;
import org.globsframework.utils.exceptions.ItemNotFound;
import org.globsframework.utils.exceptions.MissingInfo;
diff --git a/src/main/java/org/globsframework/model/indexing/IndexManager.java b/src/main/java/org/globsframework/model/indexing/IndexManager.java
index 26b3433..9507f65 100644
--- a/src/main/java/org/globsframework/model/indexing/IndexManager.java
+++ b/src/main/java/org/globsframework/model/indexing/IndexManager.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.index.*;
import org.globsframework.model.Glob;
diff --git a/src/main/java/org/globsframework/model/indexing/IndexTables.java b/src/main/java/org/globsframework/model/indexing/IndexTables.java
index d24ee72..7a54c0c 100644
--- a/src/main/java/org/globsframework/model/indexing/IndexTables.java
+++ b/src/main/java/org/globsframework/model/indexing/IndexTables.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
public interface IndexTables {
diff --git a/src/main/java/org/globsframework/model/indexing/IndexedTable.java b/src/main/java/org/globsframework/model/indexing/IndexedTable.java
index e980e74..254c753 100644
--- a/src/main/java/org/globsframework/model/indexing/IndexedTable.java
+++ b/src/main/java/org/globsframework/model/indexing/IndexedTable.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.GlobList;
diff --git a/src/main/java/org/globsframework/model/indexing/NullIndex.java b/src/main/java/org/globsframework/model/indexing/NullIndex.java
index 16c90b3..4b733a2 100644
--- a/src/main/java/org/globsframework/model/indexing/NullIndex.java
+++ b/src/main/java/org/globsframework/model/indexing/NullIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.GlobList;
import org.globsframework.model.GlobRepository;
import org.globsframework.model.utils.GlobFunctor;
diff --git a/src/main/java/org/globsframework/model/indexing/builders/MultiFieldIndexBuilder.java b/src/main/java/org/globsframework/model/indexing/builders/MultiFieldIndexBuilder.java
index bf3a114..d05acc5 100644
--- a/src/main/java/org/globsframework/model/indexing/builders/MultiFieldIndexBuilder.java
+++ b/src/main/java/org/globsframework/model/indexing/builders/MultiFieldIndexBuilder.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.builders;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.indexing.indices.UpdatableMultiFieldIndex;
public interface MultiFieldIndexBuilder {
diff --git a/src/main/java/org/globsframework/model/indexing/builders/NotUniqueLeafFieldIndexBuilder.java b/src/main/java/org/globsframework/model/indexing/builders/NotUniqueLeafFieldIndexBuilder.java
index 69dbeed..de5add4 100644
--- a/src/main/java/org/globsframework/model/indexing/builders/NotUniqueLeafFieldIndexBuilder.java
+++ b/src/main/java/org/globsframework/model/indexing/builders/NotUniqueLeafFieldIndexBuilder.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.builders;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.indexing.indices.NotUniqueLeafLevelIndex;
import org.globsframework.model.indexing.indices.UpdatableMultiFieldIndex;
diff --git a/src/main/java/org/globsframework/model/indexing/builders/UniqueLeafFieldIndexBuilder.java b/src/main/java/org/globsframework/model/indexing/builders/UniqueLeafFieldIndexBuilder.java
index fc4d5a4..b852fad 100644
--- a/src/main/java/org/globsframework/model/indexing/builders/UniqueLeafFieldIndexBuilder.java
+++ b/src/main/java/org/globsframework/model/indexing/builders/UniqueLeafFieldIndexBuilder.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.builders;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.indexing.indices.UniqueLeafLevelIndex;
import org.globsframework.model.indexing.indices.UpdatableMultiFieldIndex;
diff --git a/src/main/java/org/globsframework/model/indexing/indices/DefaultNotUniqueIndex.java b/src/main/java/org/globsframework/model/indexing/indices/DefaultNotUniqueIndex.java
index 2a10e46..91b2fca 100644
--- a/src/main/java/org/globsframework/model/indexing/indices/DefaultNotUniqueIndex.java
+++ b/src/main/java/org/globsframework/model/indexing/indices/DefaultNotUniqueIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.indices;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.GlobList;
import org.globsframework.model.indexing.IndexedTable;
diff --git a/src/main/java/org/globsframework/model/indexing/indices/DefaultUniqueIndex.java b/src/main/java/org/globsframework/model/indexing/indices/DefaultUniqueIndex.java
index c42c3d3..185bc8b 100644
--- a/src/main/java/org/globsframework/model/indexing/indices/DefaultUniqueIndex.java
+++ b/src/main/java/org/globsframework/model/indexing/indices/DefaultUniqueIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.indices;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.GlobList;
import org.globsframework.model.format.GlobPrinter;
diff --git a/src/main/java/org/globsframework/model/indexing/indices/ManyIndexTables.java b/src/main/java/org/globsframework/model/indexing/indices/ManyIndexTables.java
index 519dbb5..7cd20e4 100644
--- a/src/main/java/org/globsframework/model/indexing/indices/ManyIndexTables.java
+++ b/src/main/java/org/globsframework/model/indexing/indices/ManyIndexTables.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.indices;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.indexing.IndexTables;
import org.globsframework.model.indexing.IndexedTable;
diff --git a/src/main/java/org/globsframework/model/indexing/indices/MiddleLevelIndex.java b/src/main/java/org/globsframework/model/indexing/indices/MiddleLevelIndex.java
index d5aa883..6ebd611 100644
--- a/src/main/java/org/globsframework/model/indexing/indices/MiddleLevelIndex.java
+++ b/src/main/java/org/globsframework/model/indexing/indices/MiddleLevelIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.indices;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.GlobList;
import org.globsframework.model.GlobRepository;
diff --git a/src/main/java/org/globsframework/model/indexing/indices/NotUniqueLeafLevelIndex.java b/src/main/java/org/globsframework/model/indexing/indices/NotUniqueLeafLevelIndex.java
index 29437ef..2badd39 100644
--- a/src/main/java/org/globsframework/model/indexing/indices/NotUniqueLeafLevelIndex.java
+++ b/src/main/java/org/globsframework/model/indexing/indices/NotUniqueLeafLevelIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.indices;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.GlobList;
import org.globsframework.model.GlobRepository;
diff --git a/src/main/java/org/globsframework/model/indexing/indices/OneIndexTable.java b/src/main/java/org/globsframework/model/indexing/indices/OneIndexTable.java
index c64bc7d..e201b0f 100644
--- a/src/main/java/org/globsframework/model/indexing/indices/OneIndexTable.java
+++ b/src/main/java/org/globsframework/model/indexing/indices/OneIndexTable.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.indices;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.indexing.IndexTables;
import org.globsframework.model.indexing.IndexedTable;
diff --git a/src/main/java/org/globsframework/model/indexing/indices/TwoIndexTables.java b/src/main/java/org/globsframework/model/indexing/indices/TwoIndexTables.java
index d8cb17b..2e6ab9c 100644
--- a/src/main/java/org/globsframework/model/indexing/indices/TwoIndexTables.java
+++ b/src/main/java/org/globsframework/model/indexing/indices/TwoIndexTables.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.indices;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.indexing.IndexTables;
import org.globsframework.model.indexing.IndexedTable;
diff --git a/src/main/java/org/globsframework/model/indexing/indices/UniqueLeafLevelIndex.java b/src/main/java/org/globsframework/model/indexing/indices/UniqueLeafLevelIndex.java
index 4944724..2ecc519 100644
--- a/src/main/java/org/globsframework/model/indexing/indices/UniqueLeafLevelIndex.java
+++ b/src/main/java/org/globsframework/model/indexing/indices/UniqueLeafLevelIndex.java
@@ -1,6 +1,6 @@
package org.globsframework.model.indexing.indices;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.GlobList;
import org.globsframework.model.GlobRepository;
diff --git a/src/main/java/org/globsframework/model/repository/DefaultGlobRepository.java b/src/main/java/org/globsframework/model/repository/DefaultGlobRepository.java
index ee1ecdb..8107224 100644
--- a/src/main/java/org/globsframework/model/repository/DefaultGlobRepository.java
+++ b/src/main/java/org/globsframework/model/repository/DefaultGlobRepository.java
@@ -1,6 +1,6 @@
package org.globsframework.model.repository;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.IntegerField;
import org.globsframework.metamodel.index.MultiFieldIndex;
diff --git a/src/main/java/org/globsframework/model/repository/GlobRepositoryDecorator.java b/src/main/java/org/globsframework/model/repository/GlobRepositoryDecorator.java
index 4ee38fe..d510c66 100644
--- a/src/main/java/org/globsframework/model/repository/GlobRepositoryDecorator.java
+++ b/src/main/java/org/globsframework/model/repository/GlobRepositoryDecorator.java
@@ -1,6 +1,6 @@
package org.globsframework.model.repository;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.index.SingleFieldIndex;
import org.globsframework.metamodel.index.MultiFieldIndex;
diff --git a/src/main/java/org/globsframework/model/repository/ReplicationGlobRepository.java b/src/main/java/org/globsframework/model/repository/ReplicationGlobRepository.java
index 0a460a4..9cc5d5e 100644
--- a/src/main/java/org/globsframework/model/repository/ReplicationGlobRepository.java
+++ b/src/main/java/org/globsframework/model/repository/ReplicationGlobRepository.java
@@ -1,6 +1,6 @@
package org.globsframework.model.repository;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.index.SingleFieldIndex;
import org.globsframework.metamodel.index.MultiFieldIndex;
diff --git a/src/main/java/org/globsframework/model/repository/StrictGlobRepository.java b/src/main/java/org/globsframework/model/repository/StrictGlobRepository.java
index eae93ee..26ba65d 100644
--- a/src/main/java/org/globsframework/model/repository/StrictGlobRepository.java
+++ b/src/main/java/org/globsframework/model/repository/StrictGlobRepository.java
@@ -1,6 +1,6 @@
package org.globsframework.model.repository;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.*;
import org.globsframework.model.utils.GlobFunctor;
diff --git a/src/main/java/org/globsframework/model/utils/AbstractMutableFieldValues.java b/src/main/java/org/globsframework/model/utils/AbstractMutableFieldValues.java
index da88844..3496f94 100644
--- a/src/main/java/org/globsframework/model/utils/AbstractMutableFieldValues.java
+++ b/src/main/java/org/globsframework/model/utils/AbstractMutableFieldValues.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.FieldSetter;
import org.globsframework.model.FieldValues;
diff --git a/src/main/java/org/globsframework/model/utils/ArrayFieldValues.java b/src/main/java/org/globsframework/model/utils/ArrayFieldValues.java
index 2d1b829..f63105a 100644
--- a/src/main/java/org/globsframework/model/utils/ArrayFieldValues.java
+++ b/src/main/java/org/globsframework/model/utils/ArrayFieldValues.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValue;
import org.globsframework.model.impl.AbstractFieldValues;
diff --git a/src/main/java/org/globsframework/model/utils/ChangeSetSequencer.java b/src/main/java/org/globsframework/model/utils/ChangeSetSequencer.java
index 7680824..aa99b15 100644
--- a/src/main/java/org/globsframework/model/utils/ChangeSetSequencer.java
+++ b/src/main/java/org/globsframework/model/utils/ChangeSetSequencer.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobModel;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.utils.GlobTypeDependencies;
diff --git a/src/main/java/org/globsframework/model/utils/DefaultFieldValues.java b/src/main/java/org/globsframework/model/utils/DefaultFieldValues.java
index 1ac5099..aa2d144 100644
--- a/src/main/java/org/globsframework/model/utils/DefaultFieldValues.java
+++ b/src/main/java/org/globsframework/model/utils/DefaultFieldValues.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValue;
import org.globsframework.model.FieldValues;
diff --git a/src/main/java/org/globsframework/model/utils/DefaultFieldValuesWithPrevious.java b/src/main/java/org/globsframework/model/utils/DefaultFieldValuesWithPrevious.java
index d90a9c1..4cf4b22 100644
--- a/src/main/java/org/globsframework/model/utils/DefaultFieldValuesWithPrevious.java
+++ b/src/main/java/org/globsframework/model/utils/DefaultFieldValuesWithPrevious.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValue;
diff --git a/src/main/java/org/globsframework/model/utils/FieldChangeListener.java b/src/main/java/org/globsframework/model/utils/FieldChangeListener.java
index fbe4838..609af8e 100644
--- a/src/main/java/org/globsframework/model/utils/FieldChangeListener.java
+++ b/src/main/java/org/globsframework/model/utils/FieldChangeListener.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.ChangeSet;
import org.globsframework.model.ChangeSetListener;
diff --git a/src/main/java/org/globsframework/model/utils/FieldCheck.java b/src/main/java/org/globsframework/model/utils/FieldCheck.java
index 8a17523..4228def 100644
--- a/src/main/java/org/globsframework/model/utils/FieldCheck.java
+++ b/src/main/java/org/globsframework/model/utils/FieldCheck.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.utils.exceptions.InvalidParameter;
diff --git a/src/main/java/org/globsframework/model/utils/FieldValueGetter.java b/src/main/java/org/globsframework/model/utils/FieldValueGetter.java
index 69202fc..26cbb92 100644
--- a/src/main/java/org/globsframework/model/utils/FieldValueGetter.java
+++ b/src/main/java/org/globsframework/model/utils/FieldValueGetter.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
public interface FieldValueGetter {
boolean contains(Field field);
diff --git a/src/main/java/org/globsframework/model/utils/GlobArrayFieldValues.java b/src/main/java/org/globsframework/model/utils/GlobArrayFieldValues.java
index 6a52481..959eb75 100644
--- a/src/main/java/org/globsframework/model/utils/GlobArrayFieldValues.java
+++ b/src/main/java/org/globsframework/model/utils/GlobArrayFieldValues.java
@@ -1,12 +1,11 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.FieldValueVisitor;
import org.globsframework.model.FieldValue;
import org.globsframework.model.FieldValues;
import org.globsframework.model.MutableFieldValues;
-import org.globsframework.model.impl.AbstractFieldValues;
import org.globsframework.utils.Unset;
import org.globsframework.utils.exceptions.InvalidParameter;
import org.globsframework.utils.exceptions.ItemNotFound;
diff --git a/src/main/java/org/globsframework/model/utils/GlobBuilder.java b/src/main/java/org/globsframework/model/utils/GlobBuilder.java
index a993309..8f5768d 100644
--- a/src/main/java/org/globsframework/model/utils/GlobBuilder.java
+++ b/src/main/java/org/globsframework/model/utils/GlobBuilder.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.*;
diff --git a/src/main/java/org/globsframework/model/utils/GlobComparators.java b/src/main/java/org/globsframework/model/utils/GlobComparators.java
index bdf5d30..4b3853f 100644
--- a/src/main/java/org/globsframework/model/utils/GlobComparators.java
+++ b/src/main/java/org/globsframework/model/utils/GlobComparators.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import java.util.Comparator;
diff --git a/src/main/java/org/globsframework/model/utils/GlobFieldComparator.java b/src/main/java/org/globsframework/model/utils/GlobFieldComparator.java
index db7b18e..13d145d 100644
--- a/src/main/java/org/globsframework/model/utils/GlobFieldComparator.java
+++ b/src/main/java/org/globsframework/model/utils/GlobFieldComparator.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.utils.Utils;
diff --git a/src/main/java/org/globsframework/model/utils/GlobFieldMatcher.java b/src/main/java/org/globsframework/model/utils/GlobFieldMatcher.java
index 8831e57..7a54695 100644
--- a/src/main/java/org/globsframework/model/utils/GlobFieldMatcher.java
+++ b/src/main/java/org/globsframework/model/utils/GlobFieldMatcher.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.model.GlobRepository;
diff --git a/src/main/java/org/globsframework/model/utils/GlobFieldsComparator.java b/src/main/java/org/globsframework/model/utils/GlobFieldsComparator.java
index 775433b..ecae1b6 100644
--- a/src/main/java/org/globsframework/model/utils/GlobFieldsComparator.java
+++ b/src/main/java/org/globsframework/model/utils/GlobFieldsComparator.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.globsframework.utils.Utils;
diff --git a/src/main/java/org/globsframework/model/utils/GlobFunctors.java b/src/main/java/org/globsframework/model/utils/GlobFunctors.java
index 3d37e4d..d1df577 100644
--- a/src/main/java/org/globsframework/model/utils/GlobFunctors.java
+++ b/src/main/java/org/globsframework/model/utils/GlobFunctors.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.DoubleField;
import org.globsframework.metamodel.fields.IntegerField;
import org.globsframework.metamodel.fields.StringField;
diff --git a/src/main/java/org/globsframework/model/utils/GlobMatchers.java b/src/main/java/org/globsframework/model/utils/GlobMatchers.java
index 06c4a29..934c79f 100644
--- a/src/main/java/org/globsframework/model/utils/GlobMatchers.java
+++ b/src/main/java/org/globsframework/model/utils/GlobMatchers.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.metamodel.links.FieldMappingFunction;
import org.globsframework.metamodel.links.Link;
diff --git a/src/main/java/org/globsframework/model/utils/GlobUtils.java b/src/main/java/org/globsframework/model/utils/GlobUtils.java
index 1323f1c..ce5b368 100644
--- a/src/main/java/org/globsframework/model/utils/GlobUtils.java
+++ b/src/main/java/org/globsframework/model/utils/GlobUtils.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.BooleanField;
import org.globsframework.metamodel.fields.DoubleField;
diff --git a/src/main/java/org/globsframework/model/utils/ReverseGlobFieldComparator.java b/src/main/java/org/globsframework/model/utils/ReverseGlobFieldComparator.java
index 8b6c70d..8153fee 100644
--- a/src/main/java/org/globsframework/model/utils/ReverseGlobFieldComparator.java
+++ b/src/main/java/org/globsframework/model/utils/ReverseGlobFieldComparator.java
@@ -1,6 +1,6 @@
package org.globsframework.model.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import java.util.Comparator;
diff --git a/src/main/java/org/globsframework/streams/DbStream.java b/src/main/java/org/globsframework/streams/DbStream.java
index 4312535..b2f42e8 100644
--- a/src/main/java/org/globsframework/streams/DbStream.java
+++ b/src/main/java/org/globsframework/streams/DbStream.java
@@ -1,6 +1,6 @@
package org.globsframework.streams;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.streams.accessors.Accessor;
import java.util.Collection;
diff --git a/src/main/java/org/globsframework/utils/GlobTypeToGlob.java b/src/main/java/org/globsframework/utils/GlobTypeToGlob.java
index b431cbe..c45f3f4 100644
--- a/src/main/java/org/globsframework/utils/GlobTypeToGlob.java
+++ b/src/main/java/org/globsframework/utils/GlobTypeToGlob.java
@@ -1,6 +1,6 @@
package org.globsframework.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.GlobTypeBuilder;
import org.globsframework.metamodel.GlobTypeResolver;
diff --git a/src/main/java/org/globsframework/utils/StringConverter.java b/src/main/java/org/globsframework/utils/StringConverter.java
index c9b2eb4..9b01e48 100644
--- a/src/main/java/org/globsframework/utils/StringConverter.java
+++ b/src/main/java/org/globsframework/utils/StringConverter.java
@@ -1,6 +1,6 @@
package org.globsframework.utils;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.MutableGlob;
diff --git a/src/main/java/org/globsframework/utils/serialization/ByteBufferSerializationInput.java b/src/main/java/org/globsframework/utils/serialization/ByteBufferSerializationInput.java
index 6a0200d..a6a6054 100644
--- a/src/main/java/org/globsframework/utils/serialization/ByteBufferSerializationInput.java
+++ b/src/main/java/org/globsframework/utils/serialization/ByteBufferSerializationInput.java
@@ -1,6 +1,6 @@
package org.globsframework.utils.serialization;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobModel;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
diff --git a/src/main/java/org/globsframework/utils/serialization/DefaultSerializationInput.java b/src/main/java/org/globsframework/utils/serialization/DefaultSerializationInput.java
index bfbb29c..2f69989 100644
--- a/src/main/java/org/globsframework/utils/serialization/DefaultSerializationInput.java
+++ b/src/main/java/org/globsframework/utils/serialization/DefaultSerializationInput.java
@@ -1,6 +1,6 @@
package org.globsframework.utils.serialization;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobModel;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
diff --git a/src/main/java/org/globsframework/utils/serialization/DefaultSerializationOutput.java b/src/main/java/org/globsframework/utils/serialization/DefaultSerializationOutput.java
index 2433f88..bb561f5 100644
--- a/src/main/java/org/globsframework/utils/serialization/DefaultSerializationOutput.java
+++ b/src/main/java/org/globsframework/utils/serialization/DefaultSerializationOutput.java
@@ -1,16 +1,15 @@
package org.globsframework.utils.serialization;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.model.*;
import org.globsframework.utils.exceptions.InvalidData;
-import org.globsframework.utils.exceptions.InvalidFormat;
import org.globsframework.utils.exceptions.UnexpectedApplicationState;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.util.Date;
@@ -176,11 +175,7 @@ public void writeUtf8String(String value) {
if (value == null) {
writeBytes(null);
} else {
- try {
- writeBytes(value.getBytes("UTF-8"));
- } catch (UnsupportedEncodingException e) {
- throw new InvalidFormat(e);
- }
+ writeBytes(value.getBytes(StandardCharsets.UTF_8));
}
}
diff --git a/src/test/java/org/globsframework/Sample.java b/src/test/java/org/globsframework/Sample.java
index ad528b4..b62600e 100644
--- a/src/test/java/org/globsframework/Sample.java
+++ b/src/test/java/org/globsframework/Sample.java
@@ -1,6 +1,6 @@
package org.globsframework;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.GlobTypeBuilderFactory;
import org.globsframework.metamodel.GlobTypeLoaderFactory;
diff --git a/src/test/java/org/globsframework/functional/impl/DefaultFunctionalKeyRepositoryTest.java b/src/test/java/org/globsframework/functional/impl/DefaultFunctionalKeyRepositoryTest.java
index 1cea36d..c2691e7 100644
--- a/src/test/java/org/globsframework/functional/impl/DefaultFunctionalKeyRepositoryTest.java
+++ b/src/test/java/org/globsframework/functional/impl/DefaultFunctionalKeyRepositoryTest.java
@@ -5,7 +5,7 @@
import org.globsframework.functional.FunctionalKeyRepository;
import org.globsframework.metamodel.DummyObject;
import org.globsframework.metamodel.DummyObject2;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.junit.Assert;
import org.junit.Test;
diff --git a/src/test/java/org/globsframework/functional/impl/DefaultLinkManagerTest.java b/src/test/java/org/globsframework/functional/impl/DefaultLinkManagerTest.java
index 49f7154..496df3a 100644
--- a/src/test/java/org/globsframework/functional/impl/DefaultLinkManagerTest.java
+++ b/src/test/java/org/globsframework/functional/impl/DefaultLinkManagerTest.java
@@ -4,7 +4,7 @@
import org.globsframework.functional.FunctionalKeyBuilderFactory;
import org.globsframework.metamodel.DummyObject;
import org.globsframework.metamodel.DummyObject2;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import org.junit.Assert;
import org.junit.Test;
diff --git a/src/test/java/org/globsframework/metamodel/GlobTypeLoaderTest.java b/src/test/java/org/globsframework/metamodel/GlobTypeLoaderTest.java
index 7618e0d..89cc3ee 100644
--- a/src/test/java/org/globsframework/metamodel/GlobTypeLoaderTest.java
+++ b/src/test/java/org/globsframework/metamodel/GlobTypeLoaderTest.java
@@ -102,7 +102,7 @@ public void testDefaultCase() throws Exception {
assertEquals(1.1, AnObject.glob.get(AnObject.DOUBLE), 0.00001);
assertEquals(Boolean.FALSE, AnObject.glob.get(AnObject.BOOLEAN));
assertFalse(AnObject.glob.isTrue(AnObject.BOOLEAN));
- assertEquals(new Long(15), AnObject.glob.get(AnObject.LONG));
+ assertEquals(Long.valueOf(15), AnObject.glob.get(AnObject.LONG));
assertEquals(TestUtils.SAMPLE_BYTE_ARRAY, AnObject.glob.get(AnObject.BLOB));
assertTrue(AnObject.A.valueEqual(AnObject.glob.get(AnObject.A), BigDecimal.valueOf(3.3)));
diff --git a/src/test/java/org/globsframework/metamodel/properties/impl/PropertyBuilderTest.java b/src/test/java/org/globsframework/metamodel/properties/impl/PropertyBuilderTest.java
deleted file mode 100644
index 45698ef..0000000
--- a/src/test/java/org/globsframework/metamodel/properties/impl/PropertyBuilderTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.globsframework.metamodel.properties.impl;
-
-import org.globsframework.metamodel.properties.Property;
-import org.globsframework.utils.Ref;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class PropertyBuilderTest {
-
- static class SomeClass extends InheritedPropertyHolder {
- int id;
-
- public SomeClass(int id) {
- this.id = id;
- }
-
- public String getName() {
- return "SomeName";
- }
- }
-
- @Test
- public void testSetGet() throws Exception {
- PropertiesBuilder builder = new PropertiesBuilder<>();
-
- Property> prop =
- builder.createProperty("test", myClass -> new Ref<>(myClass.id));
- Property> prop2 =
- builder.createProperty("test2", myClass -> new Ref<>(myClass.id));
- Property> prop3 =
- builder.createProperty("test3", myClass -> new Ref<>(myClass.id));
-
- SomeClass c1 = new SomeClass(1);
- SomeClass c2 = new SomeClass(2);
- assertEquals(c1.id, c1.getProperty(prop).get().intValue());
- assertEquals(c1.id, c1.getProperty(prop2).get().intValue());
- assertEquals(c2.id, c2.getProperty(prop3).get().intValue());
- c1.getProperty(prop).set(12);
- assertEquals(12, c1.getProperty(prop).get().intValue());
- }
-}
\ No newline at end of file
diff --git a/src/test/java/org/globsframework/metamodel/utils/DefaultGlobModelTest.java b/src/test/java/org/globsframework/metamodel/utils/DefaultGlobModelTest.java
index 6e149d5..36f6c23 100644
--- a/src/test/java/org/globsframework/metamodel/utils/DefaultGlobModelTest.java
+++ b/src/test/java/org/globsframework/metamodel/utils/DefaultGlobModelTest.java
@@ -28,18 +28,6 @@ public void testStandardCase() throws Exception {
assertEquals(DummyObject2.TYPE, model.getType(DummyObject2.TYPE.getName()));
}
- @Test
- public void testPropertyIdAllocationIsDelegatedToTheInnerModel() throws Exception {
-
- assertEquals(0, inner.createFieldProperty("prop1", null).getId());
- assertEquals(1, inner.createFieldProperty("prop2", null).getId());
- assertEquals(2, model.createFieldProperty("prop3", null).getId());
-
- assertEquals(0, inner.createGlobTypeProperty("prop1", null).getId());
- assertEquals(1, inner.createGlobTypeProperty("prop2", null).getId());
- assertEquals(2, model.createGlobTypeProperty("prop3", null).getId());
- }
-
public static class LargeLinkCycle1 {
public static GlobType TYPE;
diff --git a/src/test/java/org/globsframework/metamodel/utils/DefaultGlobTypeTest.java b/src/test/java/org/globsframework/metamodel/utils/DefaultGlobTypeTest.java
index cac8ecd..fb5efbd 100644
--- a/src/test/java/org/globsframework/metamodel/utils/DefaultGlobTypeTest.java
+++ b/src/test/java/org/globsframework/metamodel/utils/DefaultGlobTypeTest.java
@@ -1,14 +1,15 @@
package org.globsframework.metamodel.utils;
-import org.globsframework.metamodel.*;
+import org.globsframework.metamodel.GlobModel;
+import org.globsframework.metamodel.GlobType;
+import org.globsframework.metamodel.GlobTypeLoader;
+import org.globsframework.metamodel.GlobTypeLoaderFactory;
import org.globsframework.metamodel.annotations.FieldNameAnnotation;
import org.globsframework.metamodel.annotations.FieldNameAnnotationType;
import org.globsframework.metamodel.annotations.KeyField;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.IntegerField;
import org.globsframework.metamodel.impl.DefaultGlobModel;
-import org.globsframework.metamodel.impl.DefaultGlobType;
-import org.globsframework.metamodel.properties.Property;
-import org.globsframework.utils.Ref;
import org.globsframework.utils.TestUtils;
import org.globsframework.utils.exceptions.UnexpectedApplicationState;
import org.junit.Assert;
@@ -21,31 +22,6 @@ public class DefaultGlobTypeTest {
private Field field;
private GlobModel globModel;
- @Test
- public void testGlobTypeProperty() throws Exception {
- initGlobType();
-
- Property> globTypeProperty =
- globModel.createGlobTypeProperty("globType info", value -> new Ref());
- assertEquals("globType info", globTypeProperty.getName());
- assertEquals(0, globTypeProperty.getId());
-
- globType.getProperty(globTypeProperty).set(3);
- assertEquals(3, globType.getProperty(globTypeProperty).get().intValue());
-
- globType.getProperty(globTypeProperty).set(4);
- assertEquals(4, globType.getProperty(globTypeProperty).get().intValue());
-
- Property property = globModel.createFieldProperty("field info", value -> 0);
- assertEquals(0, property.getId());
- field.updateProperty(property, 2);
- assertEquals(2, field.getProperty(property).intValue());
-
- field.updateProperty(property, 4);
- assertEquals(4, field.getProperty(property).intValue());
- assertEquals("field info", property.getName());
- }
-
@Test
public void testFields() {
initGlobType();
@@ -65,15 +41,6 @@ public void testFindFieldByAnnotation() {
Assert.assertSame(sku, TypeWithAnnotation.F2);
}
- @Test
- public void testFieldProperty() throws Exception {
- initGlobType();
- Property> property = globModel.createFieldProperty("field property",
- value -> new Ref());
- field.getProperty(property).set(3);
- assertEquals(3, field.getProperty(property).get().intValue());
- }
-
public static class Type {
public static GlobType TYPE;
@@ -101,7 +68,7 @@ public static class TypeWithAnnotation {
static {
GlobTypeLoaderFactory.create(TypeWithAnnotation.class, true)
- .load();
+ .load();
}
}
diff --git a/src/test/java/org/globsframework/model/GlobRepositoryChecker.java b/src/test/java/org/globsframework/model/GlobRepositoryChecker.java
index 6045439..4f90aca 100644
--- a/src/test/java/org/globsframework/model/GlobRepositoryChecker.java
+++ b/src/test/java/org/globsframework/model/GlobRepositoryChecker.java
@@ -1,6 +1,6 @@
package org.globsframework.model;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.StringField;
import org.globsframework.model.utils.GlobMatchers;
import org.globsframework.utils.Utils;
diff --git a/src/test/java/org/globsframework/model/KeyBuilderTest.java b/src/test/java/org/globsframework/model/KeyBuilderTest.java
index d67d37a..f61e764 100644
--- a/src/test/java/org/globsframework/model/KeyBuilderTest.java
+++ b/src/test/java/org/globsframework/model/KeyBuilderTest.java
@@ -3,12 +3,11 @@
import org.globsframework.metamodel.DummyObject;
import org.globsframework.metamodel.DummyObject2;
import org.globsframework.metamodel.DummyObjectWithCompositeKey;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.impl.CompositeKey;
import org.globsframework.model.impl.SingleFieldKey;
import org.globsframework.model.utils.FieldValueGetter;
import org.globsframework.utils.exceptions.InvalidParameter;
-import org.globsframework.utils.exceptions.ItemNotFound;
import org.junit.Test;
import java.util.HashMap;
@@ -171,7 +170,7 @@ public void testReturnsAnOptimizedStructureForASingleKeyType() throws Exception
values.put(DummyObject.NAME, "a");
Key key = KeyBuilder.createFromValues(DummyObject.TYPE, values);
assertTrue(key instanceof SingleFieldKey);
- assertEquals(new Integer(2), key.get(DummyObject.ID));
+ assertEquals(Integer.valueOf(2), key.get(DummyObject.ID));
try {
key.get(DummyObject.NAME);
}
diff --git a/src/test/java/org/globsframework/model/impl/CheckSetUnsetTest.java b/src/test/java/org/globsframework/model/impl/CheckSetUnsetTest.java
new file mode 100644
index 0000000..e40cfe5
--- /dev/null
+++ b/src/test/java/org/globsframework/model/impl/CheckSetUnsetTest.java
@@ -0,0 +1,42 @@
+package org.globsframework.model.impl;
+
+import org.globsframework.metamodel.GlobType;
+import org.globsframework.metamodel.GlobTypeBuilder;
+import org.globsframework.metamodel.GlobTypeBuilderFactory;
+import org.globsframework.metamodel.fields.StringField;
+import org.globsframework.model.MutableGlob;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class CheckSetUnsetTest {
+
+ @Test
+ public void testManyFieldToTestGlobImplementation() {
+ for (int i = 0; i < 256; i++) {
+ check(i);
+ }
+ }
+
+ private static void check(int nbField) {
+ final GlobTypeBuilder globTypeBuilder = GlobTypeBuilderFactory.create("test");
+ StringField[] fields = new StringField[nbField];
+ for (int i = 0; i < nbField; i++) {
+ fields[i] = globTypeBuilder.declareStringField("f_" + i);
+ }
+
+ final GlobType globType = globTypeBuilder.get();
+
+ final MutableGlob instantiate = globType.instantiate();
+ for (StringField field : fields) {
+ assertFalse(instantiate.isSet(field));
+ instantiate.set(field, "AA");
+ assertTrue(instantiate.isSet(field));
+ instantiate.unset(field);
+ assertFalse(instantiate.isSet(field));
+ instantiate.set(field, "AA");
+ assertTrue(instantiate.isSet(field));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/org/globsframework/model/impl/DefaultGlobRepositoryIndexingTest.java b/src/test/java/org/globsframework/model/impl/DefaultGlobRepositoryIndexingTest.java
index be77831..408ba0a 100644
--- a/src/test/java/org/globsframework/model/impl/DefaultGlobRepositoryIndexingTest.java
+++ b/src/test/java/org/globsframework/model/impl/DefaultGlobRepositoryIndexingTest.java
@@ -1,7 +1,7 @@
package org.globsframework.model.impl;
import org.globsframework.metamodel.DummyObjectIndex;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.*;
import org.globsframework.model.repository.LocalGlobRepository;
import org.globsframework.model.repository.LocalGlobRepositoryBuilder;
diff --git a/src/test/java/org/globsframework/model/impl/DefaultGlobRepositoryTest.java b/src/test/java/org/globsframework/model/impl/DefaultGlobRepositoryTest.java
index f5394fc..e3f41ea 100644
--- a/src/test/java/org/globsframework/model/impl/DefaultGlobRepositoryTest.java
+++ b/src/test/java/org/globsframework/model/impl/DefaultGlobRepositoryTest.java
@@ -1,6 +1,7 @@
package org.globsframework.model.impl;
import org.globsframework.metamodel.*;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.*;
import org.globsframework.model.delta.DefaultChangeSet;
import org.globsframework.model.delta.MutableChangeSet;
diff --git a/src/test/java/org/globsframework/utils/GlobTypeToGlobTest.java b/src/test/java/org/globsframework/utils/GlobTypeToGlobTest.java
index 88fd351..28a9c1c 100644
--- a/src/test/java/org/globsframework/utils/GlobTypeToGlobTest.java
+++ b/src/test/java/org/globsframework/utils/GlobTypeToGlobTest.java
@@ -3,6 +3,7 @@
import junit.framework.Assert;
import junit.framework.TestCase;
import org.globsframework.metamodel.*;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.Glob;
import java.util.Collection;
diff --git a/src/test/java/org/globsframework/utils/TestUtils.java b/src/test/java/org/globsframework/utils/TestUtils.java
index 68e168f..8559c67 100644
--- a/src/test/java/org/globsframework/utils/TestUtils.java
+++ b/src/test/java/org/globsframework/utils/TestUtils.java
@@ -1,7 +1,7 @@
package org.globsframework.utils;
import junit.framework.AssertionFailedError;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValues;
import org.globsframework.model.FieldValuesWithPrevious;
diff --git a/src/test/java/org/globsframework/xml/FieldConverter.java b/src/test/java/org/globsframework/xml/FieldConverter.java
index 357cfaf..4dcf238 100644
--- a/src/test/java/org/globsframework/xml/FieldConverter.java
+++ b/src/test/java/org/globsframework/xml/FieldConverter.java
@@ -1,6 +1,6 @@
package org.globsframework.xml;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.fields.*;
import org.globsframework.utils.exceptions.InvalidParameter;
diff --git a/src/test/java/org/globsframework/xml/XmlChangeSetParser.java b/src/test/java/org/globsframework/xml/XmlChangeSetParser.java
index cfcb63c..38845aa 100644
--- a/src/test/java/org/globsframework/xml/XmlChangeSetParser.java
+++ b/src/test/java/org/globsframework/xml/XmlChangeSetParser.java
@@ -1,6 +1,6 @@
package org.globsframework.xml;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobModel;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.FieldValuesWithPreviousBuilder;
diff --git a/src/test/java/org/globsframework/xml/XmlChangeSetVisitor.java b/src/test/java/org/globsframework/xml/XmlChangeSetVisitor.java
index 7cd820a..b2ee0ea 100644
--- a/src/test/java/org/globsframework/xml/XmlChangeSetVisitor.java
+++ b/src/test/java/org/globsframework/xml/XmlChangeSetVisitor.java
@@ -1,6 +1,6 @@
package org.globsframework.xml;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.model.*;
import org.globsframework.saxstack.writer.PrettyPrintRootXmlTag;
import org.globsframework.saxstack.writer.RootXmlTag;
diff --git a/src/test/java/org/globsframework/xml/XmlGlobParser.java b/src/test/java/org/globsframework/xml/XmlGlobParser.java
index 41a96f2..27e8ca1 100644
--- a/src/test/java/org/globsframework/xml/XmlGlobParser.java
+++ b/src/test/java/org/globsframework/xml/XmlGlobParser.java
@@ -1,6 +1,6 @@
package org.globsframework.xml;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobModel;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.IntegerField;
diff --git a/src/test/java/org/globsframework/xml/XmlGlobStreamReader.java b/src/test/java/org/globsframework/xml/XmlGlobStreamReader.java
index aa27eea..d926553 100644
--- a/src/test/java/org/globsframework/xml/XmlGlobStreamReader.java
+++ b/src/test/java/org/globsframework/xml/XmlGlobStreamReader.java
@@ -1,6 +1,6 @@
package org.globsframework.xml;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobModel;
import org.globsframework.metamodel.GlobType;
import org.globsframework.metamodel.fields.*;
diff --git a/src/test/java/org/globsframework/xml/XmlGlobWriter.java b/src/test/java/org/globsframework/xml/XmlGlobWriter.java
index 0fb137b..49c7c57 100644
--- a/src/test/java/org/globsframework/xml/XmlGlobWriter.java
+++ b/src/test/java/org/globsframework/xml/XmlGlobWriter.java
@@ -1,6 +1,6 @@
package org.globsframework.xml;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobLinkModel;
import org.globsframework.metamodel.annotations.FieldNameAnnotationType;
import org.globsframework.metamodel.links.Link;
diff --git a/src/test/java/org/globsframework/xml/XmlSingleGlobParser.java b/src/test/java/org/globsframework/xml/XmlSingleGlobParser.java
index 4f10874..0c6cc68 100644
--- a/src/test/java/org/globsframework/xml/XmlSingleGlobParser.java
+++ b/src/test/java/org/globsframework/xml/XmlSingleGlobParser.java
@@ -1,10 +1,9 @@
package org.globsframework.xml;
-import org.globsframework.metamodel.Field;
+import org.globsframework.metamodel.fields.Field;
import org.globsframework.metamodel.GlobModel;
import org.globsframework.metamodel.GlobType;
import org.globsframework.model.MutableGlob;
-import org.globsframework.model.impl.DefaultGlob;
import org.globsframework.utils.exceptions.InvalidParameter;
import org.xml.sax.Attributes;