Skip to content

Commit f20b4f9

Browse files
committed
Reintroduce backwards compatible method signatures
1 parent 2c9898b commit f20b4f9

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

core/esmf-aspect-model-document-generators/src/main/java/org/eclipse/esmf/aspectmodel/generator/JsonGenerator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public String generateYaml() {
7171
* @deprecated Use {@link #generateJson()} instead
7272
*/
7373
@Deprecated( forRemoval = true )
74-
public String generateJsonPretty() {
74+
public String generateJsonPretty() throws IOException {
7575
return generateJson();
7676
}
7777

@@ -82,7 +82,7 @@ public String generateJsonPretty() {
8282
* @deprecated Use {@link #generate(Function)} instead
8383
*/
8484
@Deprecated( forRemoval = true )
85-
public void generateJsonPretty( final Function<String, OutputStream> nameMapper ) {
85+
public void generateJsonPretty( final Function<String, OutputStream> nameMapper ) throws IOException {
8686
generate( nameMapper );
8787
}
8888

@@ -93,13 +93,13 @@ public void generateJsonPretty( final Function<String, OutputStream> nameMapper
9393
* @deprecated Use {@link #generate(Function)} instead
9494
*/
9595
@Deprecated( forRemoval = true )
96-
public void generateJson( final Function<String, OutputStream> nameMapper ) {
96+
public void generateJson( final Function<String, OutputStream> nameMapper ) throws IOException {
9797
generate( nameMapper );
9898
}
9999

100100
@Override
101101
protected void write( final Artifact<String, R> artifact, final Function<String, OutputStream> nameMapper ) {
102-
try ( final OutputStream output = nameMapper.apply( aspect.getName() ) ) {
102+
try ( final OutputStream output = nameMapper.apply( aspect().getName() ) ) {
103103
output.write( artifact.serialize() );
104104
output.flush();
105105
} catch ( final IOException exception ) {

core/esmf-aspect-model-document-generators/src/main/java/org/eclipse/esmf/aspectmodel/generator/jsonschema/AspectModelJsonSchemaGenerator.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
public class AspectModelJsonSchemaGenerator extends JsonGenerator<JsonSchemaGenerationConfig, JsonNode, JsonSchemaArtifact> {
2727
public static final JsonSchemaGenerationConfig DEFAULT_CONFIG = JsonSchemaGenerationConfigBuilder.builder().build();
2828

29+
/**
30+
* Kept for backwards compatibility
31+
*/
32+
@Deprecated( forRemoval = true )
33+
public static final AspectModelJsonSchemaGenerator INSTANCE = new AspectModelJsonSchemaGenerator( null );
34+
2935
public AspectModelJsonSchemaGenerator( final Aspect aspect ) {
3036
this( aspect, DEFAULT_CONFIG );
3137
}
@@ -34,6 +40,14 @@ public AspectModelJsonSchemaGenerator( final Aspect aspect, final JsonSchemaGene
3440
super( aspect, config );
3541
}
3642

43+
/**
44+
* @deprecated Use {@link #AspectModelJsonSchemaGenerator(Aspect, JsonSchemaGenerationConfig)} and {@link #singleResult()} instead
45+
*/
46+
@Deprecated( forRemoval = true )
47+
public JsonSchemaArtifact apply( final Aspect aspect, final JsonSchemaGenerationConfig config ) {
48+
return new AspectModelJsonSchemaGenerator( aspect, config ).singleResult();
49+
}
50+
3751
@Override
3852
public Stream<JsonSchemaArtifact> generate() {
3953
final AspectModelJsonSchemaVisitor visitor = new AspectModelJsonSchemaVisitor( config );
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@ protected <E extends ModelElement> Stream<A> applyTemplate(
6969
return elements( clazz ).map( element -> artifactGenerator.apply( element, config ) );
7070
}
7171

72-
protected void writeCharSequenceToOutputStream( final CharSequence charSequence, final OutputStream outputStream )
73-
throws IOException {
74-
try ( final Writer writer = new OutputStreamWriter( outputStream, StandardCharsets.UTF_8 ) ) {
75-
for ( int i = 0; i < charSequence.length(); i++ ) {
76-
writer.write( charSequence.charAt( i ) );
77-
}
78-
writer.flush();
79-
}
80-
}
81-
8272
/**
8373
* Generates artifacts from the given Aspect model. As this generation may produce multiple artifacts, the generator
8474
* provides the caller with the identifer of the respective artifact via the callback function. The caller needs to

0 commit comments

Comments
 (0)