From af0be779c84af43b658514327c23133365744656 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Sat, 14 Dec 2024 20:04:40 -0500 Subject: [PATCH] Add getNonQualifiedClassName() abstract method --- src/main/java/gr/uom/java/xmi/UMLInitializer.java | 5 +++++ .../gr/uom/java/xmi/VariableDeclarationContainer.java | 1 + .../java/xmi/decomposition/LambdaExpressionObject.java | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/src/main/java/gr/uom/java/xmi/UMLInitializer.java b/src/main/java/gr/uom/java/xmi/UMLInitializer.java index fd2f6d75bd..999daeb7a4 100644 --- a/src/main/java/gr/uom/java/xmi/UMLInitializer.java +++ b/src/main/java/gr/uom/java/xmi/UMLInitializer.java @@ -177,6 +177,11 @@ public String getElementType() { return "initializer"; } + @Override + public String getNonQualifiedClassName() { + return className.contains(".") ? className.substring(className.lastIndexOf(".")+1, className.length()) : className; + } + @Override public String getClassName() { return className; diff --git a/src/main/java/gr/uom/java/xmi/VariableDeclarationContainer.java b/src/main/java/gr/uom/java/xmi/VariableDeclarationContainer.java index 538a265057..a244f22790 100644 --- a/src/main/java/gr/uom/java/xmi/VariableDeclarationContainer.java +++ b/src/main/java/gr/uom/java/xmi/VariableDeclarationContainer.java @@ -89,6 +89,7 @@ default boolean equalReturnParameter(VariableDeclarationContainer operation) { String getName(); String getElementType(); String getClassName(); + String getNonQualifiedClassName(); String toQualifiedString(); Map> variableDeclarationMap(); UMLAnonymousClass findAnonymousClass(AnonymousClassDeclarationObject anonymousClassDeclaration); diff --git a/src/main/java/gr/uom/java/xmi/decomposition/LambdaExpressionObject.java b/src/main/java/gr/uom/java/xmi/decomposition/LambdaExpressionObject.java index bbf72543aa..c312f3f023 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/LambdaExpressionObject.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/LambdaExpressionObject.java @@ -339,6 +339,15 @@ public String getElementType() { return "lambda"; } + @Override + public String getNonQualifiedClassName() { + if(owner != null) { + String className = owner.getClassName(); + return className.contains(".") ? className.substring(className.lastIndexOf(".")+1, className.length()) : className; + } + return null; + } + @Override public String getClassName() { if(owner != null) {