Skip to content

Commit

Permalink
Add classOnly query param to term vocab to filter for rowType terms o…
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoering committed Jan 3, 2025
1 parent dedd4a4 commit 9ac10fc
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public List<String> list() {

@GET
@Path("term")
public <TE extends Enum & Term> List<Term> terms(@QueryParam("prefix") String prefix) {
public <TE extends Enum & Term> List<Term> terms(@QueryParam("prefix") String prefix, @QueryParam("classOnly") boolean classOnly) {
Set<Class<? extends Enum>> classes = new HashSet<>( TermFactory.instance().listRegisteredTermEnums() );
if (prefix != null) {
prefix = prefix.toLowerCase().trim();
Expand All @@ -122,7 +122,9 @@ public <TE extends Enum & Term> List<Term> terms(@QueryParam("prefix") String pr
for (Class<? extends Enum> clazz : classes) {
Class<TE> tec = (Class<TE>) clazz;
for (TE te : tec.getEnumConstants()) {
terms.add(te);
if (!classOnly || te.isClass()) {
terms.add(te);
}
}
}

Expand Down

0 comments on commit 9ac10fc

Please sign in to comment.