Skip to content

Commit 878ef48

Browse files
committed
Incorporate PR suggestions
1 parent 87265df commit 878ef48

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

core/sds-aspect-meta-model-java/src/main/java/io/openmanufacturing/sds/metamodel/loader/DefaultPropertyWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ public boolean equals( final Object o ) {
114114
return optional == that.optional &&
115115
notInPayload == that.notInPayload &&
116116
isAbstract == that.isAbstract &&
117+
Objects.equals( extends_, that.extends_ ) &&
117118
Objects.equals( characteristic, that.characteristic ) &&
118119
Objects.equals( exampleValue, that.exampleValue );
119120
}
120121

121122
@Override
122123
public int hashCode() {
123-
return Objects.hash( super.hashCode(), exampleValue, optional, notInPayload, isAbstract );
124+
return Objects.hash( super.hashCode(), exampleValue, optional, notInPayload, isAbstract, extends_ );
124125
}
125126
}

core/sds-aspect-meta-model-java/src/main/java/io/openmanufacturing/sds/metamodel/loader/MetaModelBaseAttributes.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -196,29 +196,6 @@ private static Optional<String> getName( final Resource modelElement, final BAMM
196196
return extendsStatement.flatMap( statement -> getName( statement.getObject().asResource(), bamm ) );
197197
}
198198

199-
/**
200-
* Returns a model element's name: If it's a named resource, the name is part of its URN; otherwise
201-
* (e.g., [ bamm:extends :foo ; ... ]) go up the inheritance tree recursively.
202-
*
203-
* @param modelElement the model element to retrieve the name for
204-
* @param bamm the meta model vocabulary
205-
* @return the element's local name
206-
*/
207-
private static Optional<String> getNameFromInheritanceTree( final Resource modelElement, final BAMM bamm ) {
208-
if ( !modelElement.isAnon() ) {
209-
return Optional.of( AspectModelUrn.fromUrn( modelElement.getURI() ).getName() );
210-
}
211-
212-
final Statement propertyStatement = modelElement.getProperty( bamm.property() );
213-
if ( propertyStatement != null ) {
214-
return getNameFromInheritanceTree( propertyStatement.getObject().asResource(), bamm );
215-
}
216-
217-
final Optional<Statement> extendsStatement = Streams.stream(
218-
modelElement.getModel().listStatements( modelElement, bamm._extends(), (RDFNode) null ) ).findAny();
219-
return extendsStatement.flatMap( statement -> getNameFromInheritanceTree( statement.getObject().asResource(), bamm ) );
220-
}
221-
222199
private static String getSyntheticName( final Resource modelElement, final Model model, final BAMM bamm ) {
223200
Resource parentModelElement = model.listStatements( null, null, modelElement ).next().getSubject();
224201
while ( parentModelElement.isAnon() ) {

core/sds-aspect-model-java-generator/src/test-shared/java/io/openmanufacturing/sds/test/shared/compiler/JavaCompiler.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,9 @@ public void report( final Diagnostic<? extends FileObject> diagnostic ) {
8585
};
8686

8787
final List<String> compilerOptions = List.of( "-classpath", System.getProperty( "java.class.path" ) );
88-
compiler.getTask( null, manager, diagnosticListener, compilerOptions, null, compilerInput ).
89-
90-
call();
91-
92-
return loadOrder.stream()
93-
.
94-
95-
collect( Collectors.toMap( Function.identity(), qualifiedName ->
96-
97-
defineAndLoad( qualifiedName, manager ) ) );
88+
compiler.getTask( null, manager, diagnosticListener, compilerOptions, null, compilerInput ).call();
89+
return loadOrder.stream().collect( Collectors.toMap( Function.identity(), qualifiedName ->
90+
defineAndLoad( qualifiedName, manager ) ) );
9891
}
9992

10093
@SuppressWarnings( "unchecked" )

0 commit comments

Comments
 (0)