Skip to content

Commit

Permalink
super -> $
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Jun 25, 2023
1 parent 108ce93 commit 74a8aa2
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 66 deletions.
6 changes: 3 additions & 3 deletions ddlx/src/test/java/org/jaxdb/runner/DBTestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,12 @@ protected Object invokeExplosively(final VendorFrameworkMethod frameworkMethod,
if (method.getParameterTypes().length == 1) {
try (final Connection connection = executor.getConnection()) {
if (logger.isInfoEnabled()) logger.info(toString(method) + " [" + vendor.getSimpleName() + "]");
return frameworkMethod.invokeExplosivelySuper(target, connection);
return frameworkMethod.invokeExplosively$(target, connection);
}
}

if (logger.isInfoEnabled()) logger.info(toString(method) + " [" + vendor.getSimpleName() + "]");
return frameworkMethod.invokeExplosivelySuper(target);
return frameworkMethod.invokeExplosively$(target);
}

protected class VendorFrameworkMethod extends FrameworkMethod {
Expand Down Expand Up @@ -458,7 +458,7 @@ public Object invokeExplosively(final Object target, final Object ... params) th
return DBTestRunner.this.invokeExplosively(this, target, params);
}

final Object invokeExplosivelySuper(final Object target, final Object ... params) throws Throwable {
final Object invokeExplosively$(final Object target, final Object ... params) throws Throwable {
try {
executor.sempaphore.acquire();
return super.invokeExplosively(target, params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ public static class RegressionTest extends NumericFunctionDynamicTest {
}

public static void assertBigDecimalEquals(final BigDecimal expected, final BigDecimal actual) {
assertEquals(0, expected.compareTo(actual));
if (expected == null)
assertNull(actual);
else
assertEquals(0, expected.compareTo(actual));
}

private static final MathContext mc = new MathContext(65, RoundingMode.DOWN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected Object invokeExplosively(final VendorFrameworkMethod frameworkMethod,
TestCommand.Select.beforeInvokeExplosively(method);

if (parameterTypes.length == 0)
return frameworkMethod.invokeExplosivelySuper(target);
return frameworkMethod.invokeExplosively$(target);

final DBTestRunner.Executor executor = frameworkMethod.getExecutor();
params = new Object[parameterTypes.length];
Expand Down Expand Up @@ -124,7 +124,7 @@ else if (Schema.class.isAssignableFrom(parameterType))
final Object result;

try {
result = frameworkMethod.invokeExplosivelySuper(target, params);
result = frameworkMethod.invokeExplosively$(target, params);
}
catch (final Throwable t) {
if (transaction != null) {
Expand Down
12 changes: 6 additions & 6 deletions jsql/src/main/java/org/jaxdb/jsql/OneToManyHashMap.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright (c) 2022 JAX-DB
*
* Permission is hereby granted, final free of charge, final to any person obtaining a copy
* of this software and associated documentation files (the "Software"), final to deal
* in the Software without restriction, final including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, final and/or sell
* copies of the Software, final and to permit persons to whom the Software is
* furnished to do so, final subject to the following conditions:
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
Expand Down
12 changes: 6 additions & 6 deletions jsql/src/main/java/org/jaxdb/jsql/OneToManyTreeMap.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright (c) 2022 JAX-DB
*
* Permission is hereby granted, final free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), final to deal
* in the Software without restriction, final including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, final and/or sell
* copies of the Software, final and to permit persons to whom the Software is
* furnished to do so, final subject to the following conditions:
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
Expand Down
10 changes: 5 additions & 5 deletions jsql/src/main/java/org/jaxdb/jsql/OneToOneHashTreeMap.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright (c) 2022 JAX-DB
*
* Permission is hereby granted, final free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), final to deal
* in the Software without restriction, final including without limitation the rights
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, final and/or sell
* copies of the Software, final and to permit persons to whom the Software is
* furnished to do so, final subject to the following conditions:
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ String writeDeclaration(final String classSimpleName) {

final String writeDeclaration(final String classSimpleName, final String typeName, final String declaredName, final String suffix) {
final StringBuilder out = new StringBuilder();
out.append("\n public final ").append(typeName).append(' ').append(fieldName).append("_CACHED() {");
out.append("\n public final ").append(typeName).append(' ').append(fieldName).append("_CACHED() { // ForeignRelation.writeDeclaration(String,String,String,String)");
out.append("\n final ").append(CacheMap.class.getName()).append('<').append(declaredName).append("> cache = ").append(referenceTable.singletonInstanceName).append('.').append(cacheMapFieldNameForeign).append(';');
out.append("\n return cache == null ? null : cache.get").append(suffix).append("(").append(keyClause(cacheIndexFieldNameForeign).replace("{1}", classSimpleName).replace("{2}", "Old")).append(");");
out.append("\n }\n");
out.append("\n public final ").append(typeName).append(' ').append(fieldName).append("_SELECT() throws ").append(IOException.class.getName()).append(", ").append(SQLException.class.getName()).append(" {");
out.append("\n public final ").append(typeName).append(' ').append(fieldName).append("_SELECT() throws ").append(IOException.class.getName()).append(", ").append(SQLException.class.getName()).append(" { // ForeignRelation.writeDeclaration(String,String,String,String)");
out.append("\n final ").append(CacheMap.class.getName()).append('<').append(declaredName).append("> cache = ").append(referenceTable.singletonInstanceName).append('.').append(cacheMapFieldNameForeign).append(';');
out.append("\n return cache == null ? null : cache.select").append(suffix).append("(").append(keyClause(cacheIndexFieldNameForeign).replace("{1}", classSimpleName).replace("{2}", "Old")).append(");");
out.append("\n }");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ManyToManyRelation extends ForeignRelation {
@Override
String writeCacheInsert(final String classSimpleName, final CurOld curOld) {
final String method = indexType.isUnique ? "put$" : "add$";
return writeNullCheckClause(classSimpleName, curOld) + tableModel.singletonInstanceName + "." + cacheMapFieldName + "." + method + "(" + keyClause(cacheIndexFieldNameForeign).replace("{1}", classSimpleName).replace("{2}", curOld.toString()) + ", " + classSimpleName + ".this);";
return writeNullCheckClause(classSimpleName, curOld) + tableModel.singletonInstanceName + "." + cacheMapFieldName + "." + method + "(" + keyClause(cacheIndexFieldNameForeign).replace("{1}", classSimpleName).replace("{2}", curOld.toString()) + ", " + classSimpleName + ".this); // ManyToManyRelation.writeCacheInsert(String,CurlOld)";
}

@Override
Expand Down
22 changes: 11 additions & 11 deletions jsql/src/main/java/org/jaxdb/jsql/generator/Relation.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ private String writeGetRangeMethod(final String returnType) {
return "";

return
"\n public " + SortedMap.class.getName() + "<" + data.Key.class.getCanonicalName() + "," + returnType + "> " + cacheMethodName + "_CACHED(" + rangeParams + ") {" +
"\n public " + SortedMap.class.getName() + "<" + data.Key.class.getCanonicalName() + "," + returnType + "> " + cacheMethodName + "_CACHED(" + rangeParams + ") { // Relation.writeGetRangeMethod(String)" +
"\n return " + tableModel.singletonInstanceName + "." + cacheMapFieldName + ".subMap(" + rangeArgs + ");" +
"\n }\n" +
"\n public " + SortedMap.class.getName() + "<" + data.Key.class.getCanonicalName() + "," + returnType + "> " + cacheMethodName + "_SELECT(" + rangeParams + ") throws " + IOException.class.getName() + ", " + SQLException.class.getName() + " {" +
"\n public " + SortedMap.class.getName() + "<" + data.Key.class.getCanonicalName() + "," + returnType + "> " + cacheMethodName + "_SELECT(" + rangeParams + ") throws " + IOException.class.getName() + ", " + SQLException.class.getName() + " { // Relation.writeGetRangeMethod(String)" +
"\n return " + tableModel.singletonInstanceName + "." + cacheMapFieldName + ".select(" + rangeArgs + ");" +
"\n }\n";
}
Expand Down Expand Up @@ -154,26 +154,26 @@ final String writeCacheDeclare(final LinkedHashSet<String> keyClauseColumnAssign
keyClauseColumnAssignments(keyClauseColumnAssignments);
final String returnType = indexType.isUnique ? declarationName : indexType.getInterfaceClass(declarationName);
return
"\n private " + data.Column.class.getCanonicalName() + "<?>[] " + cacheIndexFieldName + ";" +
"\n private " + data.Column.class.getCanonicalName() + "<?>[] " + cacheIndexFieldName + "; // Relation.writeCacheDeclare(LinkedHashSet)" +
"\n " + indexType.getConcreteClass(declarationName) + " " + cacheMapFieldName + ";\n" +
"\n public " + returnType + " " + cacheMethodName + "_CACHED(" + keyParams + ") {" +
"\n public " + returnType + " " + cacheMethodName + "_CACHED(" + keyParams + ") { // Relation.writeCacheDeclare(LinkedHashSet)" +
"\n return " + tableModel.singletonInstanceName + "." + cacheMapFieldName + ".get(" + keyArgs + ");" +
"\n }\n" +
"\n public " + returnType + " " + cacheMethodName + "_SELECT(" + keyParams + ") throws " + IOException.class.getName() + ", " + SQLException.class.getName() + " {" +
"\n public " + returnType + " " + cacheMethodName + "_SELECT(" + keyParams + ") throws " + IOException.class.getName() + ", " + SQLException.class.getName() + " { // Relation.writeCacheDeclare(LinkedHashSet)" +
"\n return " + tableModel.singletonInstanceName + "." + cacheMapFieldName + ".select(" + keyArgs + ");" +
"\n }\n" +
writeGetRangeMethod(returnType) +
"\n public " + indexType.getInterfaceClass(returnType) + " " + cacheMethodName + "_CACHED() {" +
"\n public " + indexType.getInterfaceClass(returnType) + " " + cacheMethodName + "_CACHED() { // Relation.writeCacheDeclare(LinkedHashSet)" +
"\n return " + tableModel.singletonInstanceName + "." + cacheMapFieldName + ";" +
"\n }\n" +
"\n public " + indexType.getInterfaceClass(returnType) + " " + cacheMethodName + "_SELECT() throws " + IOException.class.getName() + ", " + SQLException.class.getName() + " {" +
"\n public " + indexType.getInterfaceClass(returnType) + " " + cacheMethodName + "_SELECT() throws " + IOException.class.getName() + ", " + SQLException.class.getName() + " { // Relation.writeCacheDeclare(LinkedHashSet)" +
"\n " + tableModel.singletonInstanceName + "." + cacheMapFieldName + ".selectAll();" +
"\n return " + tableModel.singletonInstanceName + "." + cacheMapFieldName + ";" +
"\n }";
}

final String writeCacheInit() {
return cacheMapFieldName + " = new " + indexType.getConcreteClass(null) + "<>(this);";
return cacheMapFieldName + " = new " + indexType.getConcreteClass(null) + "<>(this); // Relation.writeCacheInit()";
}

final String writeNullCheckClause(final String classSimpleName, final CurOld curOld) {
Expand All @@ -182,15 +182,15 @@ final String writeNullCheckClause(final String classSimpleName, final CurOld cur

String writeCacheInsert(final String classSimpleName, final CurOld curOld) {
final String method = indexType.isUnique ? "put$" : "add$";
return writeNullCheckClause(classSimpleName, curOld) + tableModel.singletonInstanceName + "." + cacheMapFieldName + "." + method + "(" + keyClause().replace("{1}", classSimpleName).replace("{2}", curOld.toString()) + ", " + classSimpleName + ".this);";
return writeNullCheckClause(classSimpleName, curOld) + tableModel.singletonInstanceName + "." + cacheMapFieldName + "." + method + "(" + keyClause().replace("{1}", classSimpleName).replace("{2}", curOld.toString()) + ", " + classSimpleName + ".this); // Relation.writeCacheInsert(String,CurOld)";
}

final String writeCacheSelectAll() {
return tableModel.singletonInstanceName + "." + cacheMapFieldName + ".addKey(" + data.Key.class.getCanonicalName() + ".ALL);";
return tableModel.singletonInstanceName + "." + cacheMapFieldName + ".addKey(" + data.Key.class.getCanonicalName() + ".ALL); // Relation.writeCacheSelectAll()";
}

final String writeOnChangeClearCache(final String classSimpleName, final CurOld curOld) {
return writeNullCheckClause(classSimpleName, curOld) + tableModel.singletonInstanceName + "." + cacheMapFieldName + ".remove$" + curOld + "(" + keyClause().replace("{1}", classSimpleName).replace("{2}", curOld.toString()) + (indexType.isUnique ? "" : ", " + classSimpleName + ".this") + ");";
return writeNullCheckClause(classSimpleName, curOld) + tableModel.singletonInstanceName + "." + cacheMapFieldName + ".remove$" + curOld + "(" + keyClause().replace("{1}", classSimpleName).replace("{2}", curOld.toString()) + (indexType.isUnique ? "" : ", " + classSimpleName + ".this") + "); // Relation.writeOnChangeClearCache(String,CurlOld)";
}

@Override
Expand Down
10 changes: 5 additions & 5 deletions jsql/src/main/java/org/jaxdb/jsql/generator/SchemaModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,27 @@ String generate(final DDLx ddlx) throws GeneratorExecutionException {
out.append('\n');

out.append("\n @").append(Override.class.getName());
out.append("\n public ").append(type.Table$.class.getCanonicalName()).append("[] getTables() {");
out.append("\n public ").append(type.Table$.class.getCanonicalName()).append("[] getTables() { // SchemaModel.generate(DDLx)");
out.append("\n return tables;");
out.append("\n }\n");

out.append("\n @").append(Override.class.getName());
out.append("\n public ").append(type.Table$.class.getCanonicalName()).append(" getTable(final ").append(String.class.getName()).append(" name) {");
out.append("\n public ").append(type.Table$.class.getCanonicalName()).append(" getTable(final ").append(String.class.getName()).append(" name) { // SchemaModel.generate(DDLx)");
out.append("\n final int index = ").append(Arrays.class.getName()).append(".binarySearch(names, name);");
out.append("\n return index < 0 ? null : tables[index];");
out.append("\n }\n");

out.append("\n @").append(Override.class.getName());
out.append("\n public void setDefaultQueryConfig(final ").append(QueryConfig.class.getName()).append(" queryConfig) {");
out.append("\n public void setDefaultQueryConfig(final ").append(QueryConfig.class.getName()).append(" queryConfig) { // SchemaModel.generate(DDLx)");
out.append("\n defaultQueryConfig = queryConfig;");
out.append("\n }\n");

out.append("\n @").append(Override.class.getName());
out.append("\n public String getName() {");
out.append("\n public String getName() { // SchemaModel.generate(DDLx)");
out.append("\n return \"").append(name).append("\";");
out.append("\n }\n");

out.append("\n public ").append(schemaClassSimpleName).append("() {");
out.append("\n public ").append(schemaClassSimpleName).append("() { // SchemaModel.generate(DDLx)");
out.append("\n }");

out.append("\n}");
Expand Down
Loading

0 comments on commit 74a8aa2

Please sign in to comment.