Skip to content

Commit 3134131

Browse files
committed
Refactoring
1 parent b213479 commit 3134131

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

core/esmf-aspect-model-aas-generator/src/main/java/org/eclipse/esmf/aspectmodel/aas/AasToAspectModelGenerator.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,6 @@ public List<String> getSubmodelNames() {
172172
.collect( Collectors.toList() );
173173
}
174174

175-
protected String escapeUrnNamespacePart( String namespacePart ) {
176-
if ( namespacePart.contains( "-" ) ) {
177-
namespacePart = namespacePart.replaceAll( "-", "." );
178-
return namespacePart;
179-
}
180-
if ( namespacePart.matches( AspectModelUrn.NAMESPACE_REGEX_PART ) ) {
181-
return namespacePart;
182-
}
183-
throw new AspectModelGenerationException( "Encountered URI with invalid namespace part: " + namespacePart );
184-
}
185-
186175
private <T> Collector<T, ArrayDeque<T>, ArrayDeque<T>> reverseOrder() {
187176
return Collector.of( ArrayDeque::new, ArrayDeque::addFirst, ( deque1, deque2 ) -> {
188177
deque2.addAll( deque1 );
@@ -193,13 +182,13 @@ private <T> Collector<T, ArrayDeque<T>, ArrayDeque<T>> reverseOrder() {
193182
private String iriToReversedHostNameNotation( final IRI iri ) {
194183
final URI uri = URI.create( iri.toString().contains( "://" ) ? iri.toString() : "https://" + iri );
195184

196-
String[] hostParts = uri.getHost().split( "\\." );
197-
String[] pathParts = uri.getPath().split( "/" );
185+
final String[] hostParts = uri.getHost().split( "\\." );
186+
final String[] pathParts = uri.getPath().split( "/" );
198187

199-
String reversedHost = String.join( ".", Arrays.stream( hostParts )
188+
final String reversedHost = String.join( ".", Arrays.stream( hostParts )
200189
.collect( reverseOrder() ) );
201190

202-
String path = Arrays.stream( pathParts )
191+
final String path = Arrays.stream( pathParts )
203192
.filter( StringUtils::isNotBlank )
204193
.limit( pathParts.length - 2 )
205194
.collect( Collectors.joining( "." ) );

0 commit comments

Comments
 (0)