Skip to content

Commit

Permalink
rename annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcGuiot committed Sep 28, 2024
1 parent 262e1db commit a3c5779
Show file tree
Hide file tree
Showing 116 changed files with 1,133 additions and 1,111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.globsframework.core.model.Key;
import org.globsframework.core.utils.Ref;

import java.util.Collection;
import java.util.Optional;
import java.util.stream.Stream;

Expand All @@ -18,6 +19,8 @@ public interface Annotations {

boolean hasAnnotation(Key key);

Collection<Glob> getAnnotations();

Glob getAnnotation(Key key);

Glob findAnnotation(Key key);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.globsframework.core.metamodel;

import org.globsframework.core.metamodel.annotations.KeyAnnotationType;
import org.globsframework.core.metamodel.annotations.KeyField;
import org.globsframework.core.metamodel.fields.*;
import org.globsframework.core.metamodel.type.DataType;
import org.globsframework.core.model.Glob;
Expand All @@ -12,6 +12,8 @@
public interface GlobTypeBuilder {
GlobTypeBuilder addAnnotation(Glob annotation);

GlobTypeBuilder addAnnotations(Collection<Glob> annotation);

GlobTypeBuilder addStringField(String fieldName, Collection<Glob> annotations);

GlobTypeBuilder addStringArrayField(String fieldName, Collection<Glob> globAnnotations);
Expand Down Expand Up @@ -229,7 +231,7 @@ default GlobArrayUnionField declareGlobUnionArrayField(String fieldName, List<Gl
GlobType unCompleteType();

default GlobTypeBuilder addIntegerKey(String fieldName) {
addIntegerField(fieldName, KeyAnnotationType.UNINITIALIZED);
addIntegerField(fieldName, KeyField.UNINITIALIZED);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

public class AllAnnotations {
static final public GlobModel MODEL =
new DefaultGlobModel(AutoIncrementAnnotationType.TYPE,
ContainmentLinkAnnotationType.DESC, DefaultBooleanAnnotationType.TYPE,
DefaultDoubleAnnotationType.DESC, DefaultFieldValueType.TYPE,
DefaultIntegerAnnotationType.DESC, DefaultLongAnnotationType.DESC,
DefaultStringAnnotationType.DESC, DoublePrecisionAnnotationType.DESC,
FieldNameAnnotationType.TYPE, KeyAnnotationType.TYPE,
EnumAnnotationType.TYPE,
LinkModelNameAnnotationType.TYPE, MaxSizeType.TYPE, MultiLineTextType.TYPE,
IgnoredAnnotationType.TYPE,
CommentType.TYPE,
NamingFieldAnnotationType.TYPE, RequiredAnnotationType.TYPE,
NotUniqueIndexType.TYPE, FunctionalFieldOrderType.TYPE);
new DefaultGlobModel(AutoIncrement.TYPE,
ContainmentLink.TYPE, DefaultBoolean.TYPE,
DefaultDouble.TYPE,
DefaultInteger.TYPE, DefaultLong.TYPE,
DefaultString.TYPE, DoublePrecision.TYPE,
FieldName.TYPE, KeyField.TYPE,
EnumAnnotation.TYPE,
LinkModelName.TYPE, MaxSize.TYPE, MultiLineText.TYPE,
IgnoredAnnotation.TYPE,
Comment.TYPE,
NamingField.TYPE, Required.TYPE,
NotUniqueIndex.TYPE, FunctionalFieldOrder.TYPE);
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
package org.globsframework.core.metamodel.annotations;

import org.globsframework.core.metamodel.GlobType;
import org.globsframework.core.metamodel.GlobTypeLoaderFactory;
import org.globsframework.core.model.Glob;
import org.globsframework.core.model.Key;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
public class AutoIncrement {
public static GlobType TYPE;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface AutoIncrement {
GlobType TYPE = AutoIncrementAnnotationType.TYPE;
@InitUniqueKey
public static Key KEY;

@InitUniqueGlob
public static Glob INSTANCE;

static {
GlobTypeLoaderFactory.create(AutoIncrement.class, "AutoIncrement")
.register(GlobCreateFromAnnotation.class, annotation -> INSTANCE)
.load();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.globsframework.core.metamodel.annotations;

import org.globsframework.core.metamodel.GlobType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface AutoIncrement_ {
GlobType TYPE = AutoIncrement.TYPE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.globsframework.core.model.Glob;
import org.globsframework.core.model.Key;

public class CommentType {
public class Comment {
public static GlobType TYPE;

public static StringField VALUE;
Expand All @@ -20,7 +20,7 @@ public static Glob create(Comment_ comment) {
}

static {
GlobTypeLoader loader = GlobTypeLoaderFactory.create(CommentType.class, "Comment");
GlobTypeLoader loader = GlobTypeLoaderFactory.create(Comment.class, "Comment");
loader.register(GlobCreateFromAnnotation.class, annotation -> create((Comment_) annotation));
loader.load();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
public @interface Comment_ {
String value();

GlobType TYPE = CommentType.TYPE;
GlobType TYPE = Comment.TYPE;
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
package org.globsframework.core.metamodel.annotations;

import org.globsframework.core.metamodel.GlobType;
import org.globsframework.core.metamodel.GlobTypeLoader;
import org.globsframework.core.metamodel.GlobTypeLoaderFactory;
import org.globsframework.core.model.Glob;
import org.globsframework.core.model.Key;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
public class ContainmentLink {
public static GlobType TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;
@InitUniqueKey
public static Key UNIQUE_KEY;

@Retention(RUNTIME)
@java.lang.annotation.Target({ElementType.FIELD})
public @interface ContainmentLink {
GlobType TYPE = ContainmentLinkAnnotationType.DESC;
@InitUniqueGlob
public static Glob UNIQUE_GLOB;

static {
GlobTypeLoader loader = GlobTypeLoaderFactory.create(ContainmentLink.class, "ContainmentLink");
loader.register(GlobCreateFromAnnotation.class, annotation -> UNIQUE_GLOB)
.load();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.globsframework.core.metamodel.annotations;

import org.globsframework.core.metamodel.GlobType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Retention(RUNTIME)
@java.lang.annotation.Target({ElementType.FIELD})
public @interface IsLink {
public @interface ContainmentLink_ {
GlobType TYPE = ContainmentLink.TYPE;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
package org.globsframework.core.metamodel.annotations;

import org.globsframework.core.metamodel.GlobType;
import org.globsframework.core.metamodel.GlobTypeLoader;
import org.globsframework.core.metamodel.GlobTypeLoaderFactory;
import org.globsframework.core.metamodel.fields.BigDecimalField;
import org.globsframework.core.model.Glob;
import org.globsframework.core.model.Key;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.math.BigDecimal;

@Retention(RetentionPolicy.RUNTIME)
@java.lang.annotation.Target({ElementType.FIELD})
public @interface DefaultBigDecimal {
String value();
public class DefaultBigDecimal {

GlobType TYPE = DefaultBigDecimalAnnotationType.DESC;
public static GlobType DESC;

public static BigDecimalField VALUE;

@InitUniqueKey
public static Key UNIQUE_KEY;

public static Glob create(String defaultBigDecimal) {
return DESC.instantiate().set(VALUE, new BigDecimal(defaultBigDecimal));
}

static {
GlobTypeLoader loader = GlobTypeLoaderFactory.create(DefaultBigDecimal.class, "DefaultBigDecimal");
loader.register(GlobCreateFromAnnotation.class, annotation -> create(((DefaultBigDecimal_) annotation).value()))
.load();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

@Retention(RetentionPolicy.RUNTIME)
@java.lang.annotation.Target({ElementType.FIELD})
public @interface FieldNameAnnotation {
public @interface DefaultBigDecimal_ {
String value();

GlobType TYPE = FieldNameAnnotationType.TYPE;
GlobType TYPE = DefaultBigDecimal.DESC;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
package org.globsframework.core.metamodel.annotations;

import org.globsframework.core.metamodel.GlobType;
import org.globsframework.core.metamodel.GlobTypeLoader;
import org.globsframework.core.metamodel.GlobTypeLoaderFactory;
import org.globsframework.core.metamodel.fields.BooleanField;
import org.globsframework.core.model.Glob;
import org.globsframework.core.model.Key;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public class DefaultBoolean {
public static GlobType TYPE;

@Retention(RetentionPolicy.RUNTIME)
@java.lang.annotation.Target({ElementType.FIELD})
public @interface DefaultBoolean {
boolean value();
public static BooleanField VALUE;

GlobType TYPE = DefaultBooleanAnnotationType.TYPE;
@InitUniqueKey
public static Key UNIQUE_KEY;

public static Glob create(DefaultBoolean_ defaultDouble) {
return TYPE.instantiate().set(VALUE, defaultDouble.value());
}

static {
GlobTypeLoader loader = GlobTypeLoaderFactory.create(DefaultBoolean.class, "DefaultBoolean");
loader.register(GlobCreateFromAnnotation.class, annotation -> create((DefaultBoolean_) annotation))
.load();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.globsframework.core.metamodel.annotations;

import org.globsframework.core.metamodel.GlobType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
@java.lang.annotation.Target({ElementType.FIELD})
public @interface DefaultBoolean_ {
boolean value();

GlobType TYPE = DefaultBoolean.TYPE;
}
Loading

0 comments on commit a3c5779

Please sign in to comment.