Package org.jnode.configure.PropertySet

Examples of org.jnode.configure.PropertySet.Value


    }

    @Override
    public Value fromInput(String token) {
        if (token.equals(emptyToken)) {
            return new Value(token, "");
        } else {
            return fromValue(token);
        }
    }
View Full Code Here


    @Override
    public Value fromValue(String value) {
        Matcher matcher = pattern.matcher(value);
        if (matcher.matches()) {
            if (value.equals("") && emptyToken != null) {
                return new Value(emptyToken, value);
            } else {
                return new Value(value, value);
            }
        } else {
            return null;
        }
    }
View Full Code Here

        }
        PropertySet.Property prop = script.getProperty(guardProp);
        if (!prop.isSet()) {
            return false;
        }
        Value value = prop.getValue();
        if (valueIs != null) {
            return valueIs.getText().equals(value.getText());
        } else if (valueIsNot != null) {
            return !valueIsNot.getText().equals(value.getText());
        } else {
            return true;
        }
    }
View Full Code Here

                }
                configure.output(text);
            }
            // Capture the value for the item property
            PropertySet.Property prop = script.getProperty(item.getPropName());
            Value value = null;
            Value defaultValue = prop.getDefaultValue();
            do {
                String info = prop.getType().describe(defaultValue);
                String input = configure.input(prop.getDescription() + " " + info + ":");
                if (input == null) {
                    throw new ConfigureException("Unexpected EOF on input");
                }
                if (input.length() == 0) {
                    if (defaultValue != null) {
                        configure.debug("Using default");
                        value = defaultValue;
                    }
                } else {
                    value = prop.getType().fromInput(input);
                }
                // Loop until we get a permissible value.
            } while (value == null);
            prop.setValue(value);
            configure.output("");
            if (item.getChanged() != null) {
                // Display message if property value has changed.
                String oldValue = (defaultValue == null) ? "" : defaultValue.getText();
                String newValue = value.getText();
                if (!oldValue.equals(newValue)) {
                    configure.output(item.getChanged());
                    configure.output("");
                }
View Full Code Here

                String defaultText = child.getAttribute(DEFAULT, "");
                PropertyType type = script.getTypes().get(typeName);
                if (type == null) {
                    error("Use of undeclared type '" + typeName + "'", child);
                }
                Value defaultValue = type.fromValue(defaultText);
                configure.debug("Default value for " + name + " is " +
                        (defaultValue == null ? "null" : defaultValue.toString()));
                try {
                    propSet.addProperty(name, type, description, defaultValue, child, stack.getLast()
                            .getFile());
                } catch (ConfigureException ex) {
                    addStack(ex, child);
View Full Code Here

        }
        String guardPropName = element.getAttribute(GUARD_PROP, null);
        String valueIsStr = element.getAttribute(VALUE_IS, null);
        String valueIsNotStr = element.getAttribute(VALUE_IS_NOT, null);

        Value valueIs = null;
        Value valueIsNot = null;
        if (guardPropName != null) {
            Property guardProp = script.getProperty(guardPropName);
            if (guardProp == null) {
                error("A guard property '" + guardPropName + "' not declared", element);
            }
View Full Code Here

    @Override
    public Value fromInput(String token) {
        for (Alternate alternate : alternates) {
            if (alternate.token.equals(token)) {
                return new Value(token, alternate.value);
            }
        }
        return null;
    }
View Full Code Here

    @Override
    public Value fromValue(String value) {
        for (Alternate alternate : alternates) {
            if (alternate.value.equals(value)) {
                return new Value(alternate.token, value);
            }
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.jnode.configure.PropertySet.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.