Skip to content

Commit

Permalink
Adding an InitDeepBefore class annotation to initialize class after s…
Browse files Browse the repository at this point in the history
…uper classes
  • Loading branch information
computate committed Oct 5, 2023
1 parent 9ec841d commit 9af157f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
47 changes: 35 additions & 12 deletions src/main/java/org/computate/frFR/java/EcrireGenClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ public class EcrireGenClasse extends EcrireClasse {
* Var.enUS: classInitDeep
*/
protected Boolean classeInitLoin;
protected Boolean classeInitLoinAvant;

/**
* Var.enUS: classContainsSiteRequest
Expand Down Expand Up @@ -1384,17 +1385,33 @@ public void genCodeInitLoin(String langueNom, YAMLConfiguration langueConfig) th
wInitLoin.l();
wInitLoin.tl(1, "public Future<Void> ", langueConfig.getString(ConfigCles.var_promesseLoin), classeNomSimple, "() {");
wInitLoin.tl(2, "Promise<Void> promise = Promise.promise();");
wInitLoin.tl(2, "Promise<Void> promise2 = Promise.promise();");
wInitLoin.tl(2, langueConfig.getString(ConfigCles.var_promesse), classeNomSimple, "(promise2);");
wInitLoin.tl(2, "promise2.future().onSuccess(a -> {");
if(BooleanUtils.isTrue(classeEtendBase)) {
wInitLoin.tl(3, "super.", langueConfig.getString(ConfigCles.var_promesseLoin), classeNomSimpleSuperGenerique, "(", langueConfig.getString(ConfigCles.var_requeteSite), "_).onSuccess(b -> {");
wInitLoin.tl(4, "promise.complete();");
wInitLoin.tl(3, "}).onFailure(ex -> {");
wInitLoin.tl(4, "promise.fail(ex);");
wInitLoin.tl(3, "});");
if(classeInitLoinAvant) {
if(BooleanUtils.isTrue(classeEtendBase)) {
wInitLoin.tl(2, "super.", langueConfig.getString(ConfigCles.var_promesseLoin), classeNomSimpleSuperGenerique, "(", langueConfig.getString(ConfigCles.var_requeteSite), "_).onSuccess(a -> {");
wInitLoin.tl(3, "Promise<Void> promise2 = Promise.promise();");
wInitLoin.tl(3, langueConfig.getString(ConfigCles.var_promesse), classeNomSimple, "(promise2);");
wInitLoin.tl(3, "promise2.future().onSuccess(b -> {");
wInitLoin.tl(4, "promise.complete();");
wInitLoin.tl(3, "}).onFailure(ex -> {");
wInitLoin.tl(4, "promise.fail(ex);");
wInitLoin.tl(3, "});");
} else {
wInitLoin.tl(2, "promise2.future().onSuccess(a -> {");
wInitLoin.tl(3, "promise.complete();");
}
} else {
wInitLoin.tl(3, "promise.complete();");
wInitLoin.tl(2, "Promise<Void> promise2 = Promise.promise();");
wInitLoin.tl(2, langueConfig.getString(ConfigCles.var_promesse), classeNomSimple, "(promise2);");
wInitLoin.tl(2, "promise2.future().onSuccess(a -> {");
if(BooleanUtils.isTrue(classeEtendBase)) {
wInitLoin.tl(3, "super.", langueConfig.getString(ConfigCles.var_promesseLoin), classeNomSimpleSuperGenerique, "(", langueConfig.getString(ConfigCles.var_requeteSite), "_).onSuccess(b -> {");
wInitLoin.tl(4, "promise.complete();");
wInitLoin.tl(3, "}).onFailure(ex -> {");
wInitLoin.tl(4, "promise.fail(ex);");
wInitLoin.tl(3, "});");
} else {
wInitLoin.tl(3, "promise.complete();");
}
}
wInitLoin.tl(2, "}).onFailure(ex -> {");
wInitLoin.tl(3, "promise.fail(ex);");
Expand All @@ -1415,9 +1432,15 @@ public void genCodeInitLoin(String langueNom, YAMLConfiguration langueConfig) th
}
}
wInitLoin.l(" {");
if(classeInitLoinAvant) {
if(BooleanUtils.isTrue(classeEtendBase))
wInitLoin.tl(2, "super.", langueConfig.getString(ConfigCles.var_initLoin), classeNomSimpleSuperGenerique, "(", langueConfig.getString(ConfigCles.var_requeteSite), "_);");
}
wInitLoin.tl(2, "init", classeNomSimple, "();");
if(BooleanUtils.isTrue(classeEtendBase))
wInitLoin.tl(2, "super.", langueConfig.getString(ConfigCles.var_initLoin), classeNomSimpleSuperGenerique, "(", langueConfig.getString(ConfigCles.var_requeteSite), "_);");
if(!classeInitLoinAvant) {
if(BooleanUtils.isTrue(classeEtendBase))
wInitLoin.tl(2, "super.", langueConfig.getString(ConfigCles.var_initLoin), classeNomSimpleSuperGenerique, "(", langueConfig.getString(ConfigCles.var_requeteSite), "_);");
}
wInitLoin.tl(1, "}");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ public void ecrireGenClasse(JsonObject doc, String langueNom) throws Exception {
classeEtendBase = (Boolean)doc.getBoolean("classeEtendBase_stored_boolean");
classeEstBase = (Boolean)doc.getBoolean("classeEstBase_stored_boolean");
classeInitLoin = (Boolean)doc.getBoolean("classeInitLoin_stored_boolean");
classeInitLoinAvant = (Boolean)doc.getBoolean("classeInitLoinAvant_stored_boolean");
classeContientRequeteSite = (Boolean)doc.getBoolean("classeContientRequeteSite_stored_boolean");
classeSauvegarde = BooleanUtils.isTrue((Boolean)doc.getBoolean("classeSauvegarde_stored_boolean"));
classeIndexe = BooleanUtils.isTrue((Boolean)doc.getBoolean("classeIndexe_stored_boolean"));
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/computate/frFR/java/IndexerClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3554,6 +3554,7 @@ else if(classeQdoxSuper != null) {
classePartsZonedDateTimeDeserializer = classePartsZonedDateTimeDeserializer(nomEnsembleDomaine, classeLangueNom);
classePartsZonedDateTimeSerializer = classePartsZonedDateTimeSerializer(nomEnsembleDomaine, classeLangueNom);

indexerStockerSolr(classeDoc, "classeInitLoinAvant", regexTrouve("^" + classeLangueConfig.getString(ConfigCles.var_InitLoin) + classeLangueConfig.getString(ConfigCles.var_Avant) + ": (true)$", classeCommentaire));
Boolean classeInitLoin = !regexTrouve("^" + classeLangueConfig.getString(ConfigCles.var_InitLoin) + ":\\s*(false)$", classeCommentaire);
if(classeInitLoin)
classeInitLoin = classeEtendBase || classeEstBase;
Expand Down

0 comments on commit 9af157f

Please sign in to comment.