MCPcopy Create free account
hub / github.com/e2wugui/zeze / register

Method register

ZezeJava/ZezeJava/src/main/java/Zeze/Transaction/Log.java:36–48  ·  view source on GitHub ↗
(@NotNull IntFunction<Log> s)

Source from the content-addressed store, hash-verified

34 private static final LongConcurrentHashMap<IntFunction<Log>> factorys = new LongConcurrentHashMap<>();
35
36 public static void register(@NotNull IntFunction<Log> s) {
37 var ins = s.apply(0);
38 var old = factorys.putIfAbsent(ins.getTypeId(), s);
39 if (old == null)
40 logger.debug("register log typeId({}): {}", ins.getTypeId(), ins.getTypeName());
41 else {
42 var oldIns = old.apply(0);
43 if (!oldIns.getTypeName().equals(ins.getTypeName())) {
44 logger.error("register duplicated log typeId({}): {} & {}",
45 ins.getTypeId(), oldIns.getTypeName(), ins.getTypeName());
46 }
47 }
48 }
49
50 public static @NotNull Log create(int typeId, int varId) {
51 var factory = factorys.get(typeId);

Callers 12

registerLogBeanKeyMethod · 0.95
registerLogList1Method · 0.95
registerLogList2Method · 0.95
registerLogMap1Method · 0.95
registerLogMap2Method · 0.95
registerLogMap1MetaMethod · 0.95
registerLogMap2MetaMethod · 0.95
registerLogSet1Method · 0.95
registerLogOneMethod · 0.95
registerLogsMethod · 0.95

Calls 5

applyMethod · 0.65
putIfAbsentMethod · 0.65
getTypeIdMethod · 0.65
equalsMethod · 0.65
getTypeNameMethod · 0.45

Tested by

no test coverage detected