# HG changeset patch # User Doug Simon # Date 1383646482 -3600 # Node ID 582b3d24c6adeff19cfba0da39c2e549fe923f45 # Parent cf57663a2a365aa776c9b04cde6394b376681dc7 record an OptionDescriptor in an OptionValue so that it can be queried for a name diff -r cf57663a2a36 -r 582b3d24c6ad graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionDescriptor.java --- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionDescriptor.java Tue Nov 05 06:50:16 2013 +0100 +++ b/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionDescriptor.java Tue Nov 05 11:14:42 2013 +0100 @@ -42,6 +42,7 @@ this.option = option; this.declaringClass = declaringClass; this.fieldName = fieldName; + option.setDescriptor(this); } /** diff -r cf57663a2a36 -r 582b3d24c6ad graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionValue.java --- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionValue.java Tue Nov 05 06:50:16 2013 +0100 +++ b/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionValue.java Tue Nov 05 11:14:42 2013 +0100 @@ -32,6 +32,8 @@ */ protected T value; + private OptionDescriptor descriptor; + public OptionValue(T value) { this.value = value; } @@ -55,6 +57,26 @@ } /** + * Sets the descriptor for this option. + */ + public void setDescriptor(OptionDescriptor descriptor) { + this.descriptor = descriptor; + } + + /** + * Gets the name of this option. The name for an option value with a null + * {@linkplain #setDescriptor(OptionDescriptor) descriptor} is {@code ""}. + */ + public String getName() { + return descriptor == null ? "" : (descriptor.getDeclaringClass().getName() + "." + descriptor.getName()); + } + + @Override + public String toString() { + return getName() + "=" + value; + } + + /** * Gets the value of this option. */ public T getValue() {