java-gobject-introspection r94 - trunk/src/org/gnome/gir/gobject
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r94 - trunk/src/org/gnome/gir/gobject
- Date: Mon, 20 Oct 2008 03:37:26 +0000 (UTC)
Author: walters
Date: Mon Oct 20 03:37:26 2008
New Revision: 94
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=94&view=rev
Log:
Allow passing enums through GValue which expects int/long
Modified:
trunk/src/org/gnome/gir/gobject/GValue.java
Modified: trunk/src/org/gnome/gir/gobject/GValue.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GValue.java (original)
+++ trunk/src/org/gnome/gir/gobject/GValue.java Mon Oct 20 03:37:26 2008
@@ -139,6 +139,8 @@
return ((Number) value).intValue();
} else if (value instanceof String) {
return Integer.parseInt((String) value);
+ } else if (value instanceof Enum) {
+ return EnumMapper.getInstance().intValue((Enum<?>) value);
}
throw new IllegalArgumentException("Expected integer value, not " + value.getClass());
}
@@ -147,6 +149,8 @@
return ((Number) value).longValue();
} else if (value instanceof String) {
return Long.parseLong((String) value);
+ } else if (value instanceof Enum) {
+ return EnumMapper.getInstance().intValue((Enum<?>) value);
}
throw new IllegalArgumentException("Expected long value, not " + value.getClass());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]