Skip to content

Commit

Permalink
Deprecate backward compatibility methods in GrammarToJson and JsonToG…
Browse files Browse the repository at this point in the history
…rammar (#2902)
  • Loading branch information
kevin-m-knight-gs authored Jun 11, 2024
1 parent 2aaa5d4 commit aab28b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,17 @@ public Response model(String text,
@Context UriInfo uriInfo)
{
long start = System.currentTimeMillis();
Response response = model(text, sourceId, lineOffset, returnSourceInformation, pm);
PureGrammarParserExtensions.logExtensionList();
Response response = grammarToJson(text, (a) -> PureGrammarParser.newInstance().parseModel(a, sourceId, lineOffset, 0, returnSourceInformation), pm, "Grammar to Json : Model");
long end = System.currentTimeMillis();
MetricsHandler.observeRequest(uriInfo != null ? uriInfo.getPath() : null, start, end);
return response;
}

@Deprecated
public Response model(String text, String sourceId, int lineOffset, boolean returnSourceInformation, ProfileManager<CommonProfile> pm)
{
PureGrammarParserExtensions.logExtensionList();
return grammarToJson(text, (a) -> PureGrammarParser.newInstance().parseModel(a, sourceId, lineOffset, 0, returnSourceInformation), pm, "Grammar to Json : Model");
return model(text, sourceId, lineOffset, returnSourceInformation, pm, null);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,17 @@ public Response model(PureModelContextData pureModelContext,
@Context UriInfo uriInfo)
{
long start = System.currentTimeMillis();
Response response = model(pureModelContext, renderStyle, pm);
PureGrammarComposerExtensionLoader.logExtensionList();
Response response = jsonToGrammar(pureModelContext, renderStyle, (value, renderStyle1) -> PureGrammarComposer.newInstance(PureGrammarComposerContext.Builder.newInstance().withRenderStyle(renderStyle1).build()).renderPureModelContextData(value), pm, "Json to Grammar : Model");
long end = System.currentTimeMillis();
MetricsHandler.observeRequest(uriInfo != null ? uriInfo.getPath() : null, start, end);
return response;
}

@Deprecated
public Response model(PureModelContextData pureModelContext, RenderStyle renderStyle, ProfileManager<CommonProfile> pm)
{
PureGrammarComposerExtensionLoader.logExtensionList();
return jsonToGrammar(pureModelContext, renderStyle, (value, renderStyle1) -> PureGrammarComposer.newInstance(PureGrammarComposerContext.Builder.newInstance().withRenderStyle(renderStyle1).build()).renderPureModelContextData(value), pm, "Json to Grammar : Model");
return model(pureModelContext, renderStyle, pm, null);
}

@POST
Expand Down

0 comments on commit aab28b8

Please sign in to comment.