Example usage for com.google.gwt.dev.cfg Properties getBindingProperties

List of usage examples for com.google.gwt.dev.cfg Properties getBindingProperties

Introduction

In this page you can find the example usage for com.google.gwt.dev.cfg Properties getBindingProperties.

Prototype

public SortedSet<BindingProperty> getBindingProperties() 

Source Link

Document

Gets all deferred binding properties in sorted order.

Usage

From source file:xapi.dev.util.GenDebug.java

License:Open Source License

/**
 * In case you're too lazy to step through the debugger to find all set
 * properties, just make a call here to print out all known properties at gwt
 * compile time./*from  ww w.  j av a2s . c o m*/
 *
 * @param oracle
 *          - The property oracle to inspect and print out
 */
public static void dumpProperties(final PropertyOracle oracle) {
    if (oracle instanceof SubsetFilteringPropertyOracle) {
        try {
            Field field = SubsetFilteringPropertyOracle.class.getDeclaredField("wrappedPropertyOracle");
            field.setAccessible(true);
            PropertyOracle subOracle = (PropertyOracle) field.get(oracle);
            dumpProperties(subOracle);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return;
    }
    if (oracle instanceof ModuleSpacePropertyOracle) {
        ModuleSpacePropertyOracle mod = (ModuleSpacePropertyOracle) oracle;
        Properties props;
        try {
            Field field = mod.getClass().getDeclaredField("props");
            field.setAccessible(true);
            props = (Properties) field.get(mod);
            for (BindingProperty binding : props.getBindingProperties()) {
                System.out.println(binding.getName() + " : " + binding.getConstrainedValue());
            }
            System.out.println();
            for (ConfigurationProperty prop : props.getConfigurationProperties()) {
                System.out.print(prop.getName() + " : ");
                System.out.println((prop.isMultiValued() || prop.allowsMultipleValues() ? prop.getValues()
                        : prop.getValue()));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else if (oracle instanceof DynamicPropertyOracle) {
        DynamicPropertyOracle stat = (DynamicPropertyOracle) oracle;
        System.out.println("Prescribed props: " + Arrays.asList(stat.getPrescribedPropertyValuesByName()));
        try {
            Properties configProps;
            Field field = stat.getClass().getDeclaredField("properties");
            field.setAccessible(true);
            configProps = (Properties) field.get(stat);
            System.out.println("Properties: ");
            for (ConfigurationProperty prop : configProps.getConfigurationProperties()) {
                System.out.print(prop.getName() + " : ");
                System.out.println((prop.isMultiValued() || prop.allowsMultipleValues() ? prop.getValues()
                        : prop.getValue()));
            }
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
    } else {
        System.out.println("Unhandled properties type: " + oracle.getClass() + ":\n" + oracle);
    }
}