aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/ConstantDefinition.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/sun/gluegen/ConstantDefinition.java')
-rw-r--r--src/java/com/sun/gluegen/ConstantDefinition.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/java/com/sun/gluegen/ConstantDefinition.java b/src/java/com/sun/gluegen/ConstantDefinition.java
index e06903b..60f5cef 100644
--- a/src/java/com/sun/gluegen/ConstantDefinition.java
+++ b/src/java/com/sun/gluegen/ConstantDefinition.java
@@ -38,6 +38,8 @@ import java.util.*;
/** Represents the definition of a constant which was provided either
via a #define statement or through an enum definition. */
public class ConstantDefinition {
+ private String origName;
+ private HashSet aliasedNames;
private String name;
private String value;
private String enumName;
@@ -46,9 +48,11 @@ public class ConstantDefinition {
public ConstantDefinition(String name,
String value,
String enumName) {
+ this.origName = name;
this.name = name;
this.value = value;
this.enumName = enumName;
+ this.aliasedNames=new HashSet();
}
public boolean equals(ConstantDefinition other) {
@@ -72,7 +76,29 @@ public class ConstantDefinition {
return name.hashCode();
}
- public String getName() { return name; }
+ /** Supports renaming in Java binding. */
+ public void rename(String name) {
+ if(null!=name) {
+ this.name = name;
+ aliasedNames.add(origName);
+ }
+ }
+
+ public void addAliasedName(String name) {
+ aliasedNames.add(name);
+ }
+ public Collection getAliasedNames() {
+ return aliasedNames;
+ }
+
+ public String getOrigName() {
+ return origName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
public String getValue() { return value; }
/** Returns null if this definition was not part of an
enumeration, or if the enum was anonymous. */