Package com.google.template.soy.data

Examples of com.google.template.soy.data.SoyData


    List<String> keys = split(keyStr, '.');
    int numKeys = keys.size();

    CollectionData collectionData = this;
    for (int i = 0; i <= numKeys - 2; ++i) {
      SoyData soyData = collectionData.getSingle(keys.get(i));
      if (soyData == null || !(soyData instanceof CollectionData)) {
        return;
      }
      collectionData = (CollectionData) soyData;
    }
View Full Code Here


    List<String> keys = split(keyStr, '.');
    int numKeys = keys.size();

    CollectionData collectionData = this;
    for (int i = 0; i <= numKeys - 2; ++i) {
      SoyData soyData = collectionData.getSingle(keys.get(i));
      if (soyData == null || !(soyData instanceof CollectionData)) {
        return null;
      }
      collectionData = (CollectionData) soyData;
    }
View Full Code Here

   *     Indicates the path to the location within this data tree.
   * @return The boolean at the specified key string.
   * @throws IllegalArgumentException If no data is stored at the specified key.
   */
  public boolean getBoolean(String keyStr) {
    SoyData valueData = get(keyStr);
    if (valueData == null) {
      throw new IllegalArgumentException("Missing key: " + keyStr);
    }
    return valueData.booleanValue();
  }
View Full Code Here

   *     Indicates the path to the location within this data tree.
   * @return The integer at the specified key string.
   * @throws IllegalArgumentException If no data is stored at the specified key.
   */
  public int getInteger(String keyStr) {
    SoyData valueData = get(keyStr);
    if (valueData == null) {
      throw new IllegalArgumentException("Missing key: " + keyStr);
    }
    return valueData.integerValue();
  }
View Full Code Here

   *     Indicates the path to the location within this data tree.
   * @return The float at the specified key string.
   * @throws IllegalArgumentException If no data is stored at the specified key.
   */
  public double getFloat(String keyStr) {
    SoyData valueData = get(keyStr);
    if (valueData == null) {
      throw new IllegalArgumentException("Missing key: " + keyStr);
    }
    return valueData.floatValue();
  }
View Full Code Here

   *     Indicates the path to the location within this data tree.
   * @return The string at the specified key string.
   * @throws IllegalArgumentException If no data is stored at the specified key.
   */
  public String getString(String keyStr) {
    SoyData valueData = get(keyStr);
    if (valueData == null) {
      throw new IllegalArgumentException("Missing key: " + keyStr);
    }
    return valueData.stringValue();
  }
View Full Code Here

  public void testComputeForTofu() {

    FloorFunction floorFunction = new FloorFunction();

    SoyData float0 = FloatData.forValue(7.5);
    assertEquals(IntegerData.forValue(7),
                 floorFunction.computeForTofu(ImmutableList.of(float0)));

    SoyData integer = IntegerData.forValue(14);
    assertEquals(IntegerData.forValue(14),
                 floorFunction.computeForTofu(ImmutableList.of(integer)));
  }
View Full Code Here

  public void testComputeForTofu() {

    MaxFunction maxFunction = new MaxFunction();

    SoyData float0 = FloatData.forValue(7.5);
    SoyData float1 = FloatData.forValue(7.777);
    assertEquals(FloatData.forValue(7.777),
                 maxFunction.computeForTofu(ImmutableList.of(float0, float1)));

    SoyData integer0 = IntegerData.forValue(-7);
    SoyData integer1 = IntegerData.forValue(-8);
    assertEquals(IntegerData.forValue(-7),
                 maxFunction.computeForTofu(ImmutableList.of(integer0, integer1)));
  }
View Full Code Here


  public void testComputeForTofu() {

    LengthFunction lengthFunction = new LengthFunction();
    SoyData list = new SoyListData(1, 3, 5, 7);
    assertEquals(IntegerData.forValue(4),
                 lengthFunction.computeForTofu(ImmutableList.of(list)));
  }
View Full Code Here

  public void testComputeForTofu() {

    CeilingFunction ceilingFunction = new CeilingFunction();

    SoyData float0 = FloatData.forValue(7.5);
    assertEquals(IntegerData.forValue(8),
                 ceilingFunction.computeForTofu(ImmutableList.of(float0)));

    SoyData integer = IntegerData.forValue(14);
    assertEquals(IntegerData.forValue(14),
                 ceilingFunction.computeForTofu(ImmutableList.of(integer)));
  }
View Full Code Here

TOP

Related Classes of com.google.template.soy.data.SoyData

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.