-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- throw an exception instead of NOT_FOUND, resolves #14872 - sort beans and observers, application components go first - show shortened package where appropriate
- Loading branch information
Showing
16 changed files
with
257 additions
and
119 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
core/deployment/src/main/java/io/quarkus/deployment/dev/console/ClassName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package io.quarkus.deployment.dev.console; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* This class is used to represent a class in dev console templates. | ||
*/ | ||
public class ClassName implements Comparable<ClassName> { | ||
|
||
private final String name; | ||
|
||
public ClassName(String name) { | ||
this.name = Objects.requireNonNull(name); | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getLocalName() { | ||
int lastDot = name.lastIndexOf('.'); | ||
if (lastDot != -1) { | ||
return name.substring(lastDot + 1); | ||
} | ||
return name; | ||
} | ||
|
||
public String getPackageName() { | ||
int lastDot = name.lastIndexOf('.'); | ||
if (lastDot != -1) { | ||
return name.substring(0, lastDot); | ||
} | ||
return ""; | ||
} | ||
|
||
public String getShortenedPackageName() { | ||
return shorten(getPackageName()); | ||
} | ||
|
||
public String getShortenedName() { | ||
return shorten(name); | ||
} | ||
|
||
@Override | ||
public int compareTo(ClassName other) { | ||
return name.compareTo(other.name); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return name; | ||
} | ||
|
||
private String shorten(String value) { | ||
String[] parts = value.split("\\."); | ||
StringBuilder builder = new StringBuilder(); | ||
for (int i = 0; i < parts.length; i++) { | ||
if (i == parts.length - 1) { | ||
builder.append(parts[i]); | ||
} else { | ||
builder.append(parts[i].charAt(0)); | ||
builder.append('.'); | ||
} | ||
} | ||
return builder.toString(); | ||
} | ||
|
||
} |
29 changes: 0 additions & 29 deletions
29
extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/devconsole/ClassName.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.