@Override public SoyValue apply(Boolean input) { return BooleanData.forValue(input); } });
@Override public SoyValue apply(Boolean input) { return BooleanData.forValue(input); } });
/** * Private helper to convert a boolean result. * * @param b The boolean to convert. */ private SoyValue convertResult(boolean b) { return BooleanData.forValue(b); }
/** * Private helper to convert a boolean result. * @param b The boolean to convert. */ private SoyData convertResult(boolean b) { return BooleanData.forValue(b); }
/** * Converts a boolean value to a SoyData (specifically a BooleanData). * @param value The boolean value to convert. */ public static SoyData toSoyData(boolean value) { return BooleanData.forValue(value); }
@Override public SoyValue computeForJava(List<SoyValue> args) { SoyValue arg = args.get(0); return BooleanData.forValue(!(arg instanceof UndefinedData || arg instanceof NullData)); }
@Override public SoyData computeForJava(List<SoyValue> soyDatas) { return BooleanData.forValue(soyDatas.get(0) instanceof SoyList); } }
@Override public SoyData computeForTofu(List<SoyData> soyDatas) { return BooleanData.forValue(soyDatas.get(0) instanceof Map); } }
/** * Adds a data value. * * @param value The data to add. */ public void add(boolean value) { add(BooleanData.forValue(value)); }
/** * Puts data into this data tree at the specified key string. * * @param keyStr One or more map keys and/or list indices (separated by '.' if multiple parts). * Indicates the path to the location within this data tree. * @param value The data to put at the specified location. */ public void put(String keyStr, boolean value) { put(keyStr, BooleanData.forValue(value)); }
/** * Sets a data value at a given index. * * @param index The index. * @param value The data to set. */ public void set(int index, boolean value) { set(index, BooleanData.forValue(value)); }
/** * Sets a data value at a given index. * * @param index The index. * @param value The data to set. */ public void set(int index, boolean value) { set(index, BooleanData.forValue(value)); }
/** * Adds a data value. * @param value The data to add. */ public void add(boolean value) { add(BooleanData.forValue(value)); }
/** * Sets a data value at a given index. * @param index The index. * @param value The data to set. */ public void set(int index, boolean value) { set(index, BooleanData.forValue(value)); }
@Override public SoyValue computeForJava(List<SoyValue> args) { SoyValue arg0 = args.get(0); SoyValue arg1 = args.get(1); Preconditions.checkArgument( arg0 instanceof StringData || arg0 instanceof SanitizedContent, "First argument to strContains() function is not StringData or SanitizedContent: %s", arg0); String strArg0 = arg0.coerceToString(); String strArg1 = arg1.coerceToString(); return BooleanData.forValue(strArg0.contains(strArg1)); }
@Override public TofuJavaValue isNull() { if (soyValue == null) { throw RenderException.create( "isNull is only supported on the 'args' parameters of JavaValueFactory methods"); } return forSoyValue( BooleanData.forValue(soyValue instanceof UndefinedData || soyValue instanceof NullData), sourceLocation); }
@Override public JavaValue coerceToSoyBoolean() { return TofuJavaValue.forSoyValue( BooleanData.forValue(soyValue.coerceToBoolean()), sourceLocation); }
@Override public TofuJavaValue isNonNull() { if (soyValue == null) { throw RenderException.create( "isNonNull is only supported on the 'args' parameters of JavaValueFactory methods"); } return forSoyValue( BooleanData.forValue(!(soyValue instanceof UndefinedData || soyValue instanceof NullData)), sourceLocation); }
@Override protected SoyValue visitGreaterThanOpNode(GreaterThanOpNode node) { // note the argument reversal return BooleanData.forValue(lessThan(visit(node.getChild(1)), visit(node.getChild(0)))); }
@Override protected SoyValue visitGreaterThanOrEqualOpNode(GreaterThanOrEqualOpNode node) { // note the argument reversal return BooleanData.forValue(lessThanOrEqual(visit(node.getChild(1)), visit(node.getChild(0)))); }