Package com.volantis.xml.expression.atomic

Examples of com.volantis.xml.expression.atomic.SimpleStringValue


    public void testGetName() throws Exception {
        ExpandedName name = new ImmutableExpandedName("uri://",
                                                      "fred");
        ExpandedName other = new MutableExpandedName("uri://",
                                                     "jim");
        Value value = new SimpleStringValue(factory, "hello");
        Variable nameVar = new SimpleVariable(factory,
                                              name,
                                              value);
        Variable otherVar = new SimpleVariable(factory,
                                               other,
View Full Code Here


    public void testGetValue() throws Exception {
        ExpandedName name = new ImmutableExpandedName("uri://",
                                                      "fred");
        ExpandedName other = new MutableExpandedName("uri://",
                                                     "jim");
        Value value = new SimpleStringValue(factory, "hello");
        Variable nameVar = new SimpleVariable(factory,
                                              name,
                                              value);
        Variable otherVar = new SimpleVariable(factory,
                                               other,
View Full Code Here

        }
    }

    // javadoc inherited
    public StringValue createStringValue(String value) {
        return new SimpleStringValue(this, value);
    }
View Full Code Here

                .returns(accessorMock).any();
        expressionContextMock.expects.getFactory().
                returns(expressionFactoryMock).any();
        expressionFactoryMock.fuzzy.createStringValue(
                mockFactory.expectsInstanceOf(String.class))
                .returns(new SimpleStringValue(expressionFactoryMock,
                                               "device-name")).any();
    }
View Full Code Here

                int gcd = findGreatestCommonDenominator(height, width);

                if (outputFormat == AspectRatioOutputFormat.RATIO) {
                    String ratio = "" + (width/gcd) + SEPARATOR + (height/gcd);
                    // return the whole ratio as a string value
                    value = new SimpleStringValue(factory, ratio);
                } else if (outputFormat == AspectRatioOutputFormat.WIDTH) {
                    // return the ratio component as a int value
                    value = new SimpleIntValue(factory, width/gcd);
                } else if (outputFormat == AspectRatioOutputFormat.HEIGHT) {
                    // return the ratio component as a int value
                    value = new SimpleIntValue(factory, height/gcd);
                }
            } catch (NumberFormatException e) {
                // log it but return continue
                String badValue = "One of " + heightInPixels + " or " +
                        widthInPixels;
                String policyNames = "One of "+
                        DevicePolicyConstants.ACTUAL_HEIGHT_IN_PIXELS +
                        " or " + DevicePolicyConstants.ACTUAL_WIDTH_IN_PIXELS;
                LOGGER.info("function-bad-parameter-value",
                        new Object[] {badValue, policyNames});
            }
        }

        if (value == null) {
            // No value could be retrieved from the repository, so verify that
            // the default value is of the correct type.
            if (outputFormat == AspectRatioOutputFormat.RATIO) {
                if (defaultValue instanceof StringValue) {
                    value = defaultValue;
                } else {
                    if (defaultValue != null) {
                        // log the fact that the default was present but wrong
                        LOGGER.info("function-bad-default-value", "StringValue");
                    }
                    value = new SimpleStringValue(factory, "");
                }
            } else if (outputFormat == AspectRatioOutputFormat.WIDTH ||
                    outputFormat == AspectRatioOutputFormat.HEIGHT ) {
                if (defaultValue instanceof IntValue) {
                    value = defaultValue;
View Full Code Here

        } else {
            if (defaultValue != null) {
                // If the default value wasn't of the correct type, then log it
                LOGGER.info("function-bad-default-value", "StringValue");
            }
            value = new SimpleStringValue(factory, "");
        }
        return value;
    }
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.atomic.SimpleStringValue

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.