Skip to content

Commit

Permalink
Add a registerConstants() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
yeroc committed Apr 22, 2016
1 parent e922632 commit 8624ba6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/org/geekden/servoy/ptk/AbstractScriptObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Map;
import java.util.Set;

import com.servoy.j2db.scripting.IConstantsObject;
import com.servoy.j2db.scripting.IScriptObject;

/**
Expand Down Expand Up @@ -67,8 +68,8 @@ public abstract class AbstractScriptObject implements IScriptObject

private final Map<String, MethodInfo> methods =
new HashMap<String, MethodInfo>();
private final Set<Class<? extends IScriptObject>> types =
new HashSet<Class<? extends IScriptObject>>();
@SuppressWarnings("rawtypes")
private final Set<Class> types = new HashSet<Class>();

private boolean annotatedMethodsRegistered = false;

Expand Down Expand Up @@ -99,6 +100,14 @@ public final boolean isDeprecated(String method)
protected void register(Class<? extends IScriptObject> clazz)
{ types.add(clazz); }

/**
* Registers {@linkplain IConstantsObject constants}. Call from the constructor.
*
* @param clazz the IConstantsObject implementation to be exported.
*/
protected void registerConstants(Class<? extends IConstantsObject> clazz)
{ types.add(clazz); }

private void register(MethodInfo m)
{ methods.put(m.name(), m); }

Expand Down

0 comments on commit 8624ba6

Please sign in to comment.