Skip to content

Commit cb3e024

Browse files
Bravely allow any class type to be registered for search by simpleName
1 parent a585ca5 commit cb3e024

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ng-appserver/src/main/java/ng/appserver/templating/NGElementUtils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.slf4j.Logger;
1010
import org.slf4j.LoggerFactory;
1111

12-
import ng.appserver.NGElement;
1312
import ng.appserver.elements.NGActionURL;
1413
import ng.appserver.elements.NGBrowser;
1514
import ng.appserver.elements.NGComponentContent;
@@ -49,7 +48,7 @@ public class NGElementUtils {
4948
/**
5049
* Classes registered to be searchable by classWithName()
5150
*/
52-
private static final List<Class<? extends NGElement>> _classes = new ArrayList<>();
51+
private static final List<Class<?>> _classes = new ArrayList<>();
5352

5453
/**
5554
* A mapping of shortcuts to element classes. For example, mapping of <wo:str /> to <wo:NGString />
@@ -84,7 +83,7 @@ public class NGElementUtils {
8483
/**
8584
* Add a class to make searchable by it's simpleName, full class name or any of the given shortcuts (for tags)
8685
*/
87-
public static void addClass( final Class<? extends NGElement> clazz, final String... shortcuts ) {
86+
public static void addClass( final Class<?> clazz, final String... shortcuts ) {
8887
_classes.add( clazz );
8988

9089
for( String shortcut : shortcuts ) {
@@ -99,12 +98,12 @@ public static void addPackage( final String packageName ) {
9998
/**
10099
* @return A class matching classNameToSearch for. Searches by fully qualified class name and simpleName.
101100
*/
102-
private static Class classWithName( String classNameToSearchFor ) {
101+
private static Class<?> classWithName( String classNameToSearchFor ) {
103102
Objects.requireNonNull( classNameToSearchFor );
104103

105104
logger.debug( "Searching for class '{}'", classNameToSearchFor );
106105

107-
for( Class c : _classes ) {
106+
for( Class<?> c : _classes ) {
108107
if( c.getName().equals( classNameToSearchFor ) || c.getSimpleName().equals( classNameToSearchFor ) ) {
109108
return c;
110109
}

0 commit comments

Comments
 (0)