Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcGuiot committed Sep 26, 2024
1 parent f9ef29c commit 262e1db
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

public class DefaultUniqueFunctionalKeyRepository implements MutableFunctionalKeyRepository {
static private final Logger LOGGER = LoggerFactory.getLogger(DefaultUniqueFunctionalKeyRepository.class);
private static final Glob NULL = new DefaultGlob(DefaultGlobTypeBuilder.init("NULL GLOB").get());
private static final Glob NULL = DefaultGlobTypeBuilder.init("NULL GLOB").get().instantiate();
private final DataAccess dataAccess;
private final Map<FunctionalKey, Glob> index = new ConcurrentHashMap<>();
private final MapOfMaps<GlobType, FunctionalKeyBuilder, Boolean> indexed = new ConcurrentMapOfMaps<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class AllAnnotations {
static final public GlobModel MODEL =
new DefaultGlobModel(DefaultStringAnnotationType.DESC, AutoIncrementAnnotationType.TYPE,
new DefaultGlobModel(AutoIncrementAnnotationType.TYPE,
ContainmentLinkAnnotationType.DESC, DefaultBooleanAnnotationType.TYPE,
DefaultDoubleAnnotationType.DESC, DefaultFieldValueType.TYPE,
DefaultIntegerAnnotationType.DESC, DefaultLongAnnotationType.DESC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
import java.util.LinkedHashMap;

public class FieldNameAnnotationType {
public static GlobType TYPE;
public static final GlobType TYPE;

public static StringField NAME;
public static final StringField NAME;

@InitUniqueKey
public static Key UNIQUE_KEY;
public static final Key UNIQUE_KEY;

public static Glob create(FieldNameAnnotation nameAnnotation) {
return create(nameAnnotation.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
import org.globsframework.core.metamodel.MutableGlobModel;
import org.globsframework.core.metamodel.links.impl.DefaultMutableGlobLinkModel;
import org.globsframework.core.metamodel.utils.GlobTypeDependencies;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.globsframework.core.utils.exceptions.DuplicateGlobType;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class DefaultGlobModel implements MutableGlobModel {
private static Logger LOGGER = LoggerFactory.getLogger(DefaultGlobModel.class);
private Map<String, GlobType> typesByName = new ConcurrentHashMap<>();
private GlobModel innerModel;
private GlobTypeDependencies dependencies;
Expand Down Expand Up @@ -71,7 +69,8 @@ private void add(GlobType... types) {
public void add(GlobType type) {
GlobType put = typesByName.put(type.getName(), type);
if (put != null && put != type) {
LOGGER.error(type.getName() + " already registered : " + type.describe() + " AND " + put.describe(), new RuntimeException());
String message = type.getName() + " already registered : " + type.describe() + " AND " + put.describe();
throw new DuplicateGlobType(message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void completeInit() {
if (annotation != null) {
int index = annotation.get(KeyAnnotationType.INDEX, -1);
if (index == -1) {
((MutableAnnotations) field).addAnnotation(KeyAnnotationType.create(field.getKeyIndex()));
field.addAnnotation(KeyAnnotationType.create(field.getKeyIndex()));
keySet.add(field.getKeyIndex());
} else {
keySet.add(index);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.globsframework.core.utils.exceptions;

public class DuplicateGlobType extends RuntimeException {
public DuplicateGlobType(String message) {
super(message);
}
}

0 comments on commit 262e1db

Please sign in to comment.