/** * Precondition: The specified index contains a boolean. * Gets the boolean at the given index. * @param index The index. * @return The boolean at the given index, or null of the index is undefined. */ public boolean getBoolean(int index) { return get(index).booleanValue(); }
/** * Precondition: The specified index contains a boolean. Gets the boolean at the given index. * * @param index The index. * @return The boolean at the given index, or null of the index is undefined. */ public boolean getBoolean(int index) { return get(index).booleanValue(); }
/** * Precondition: The specified index contains a boolean. Gets the boolean at the given index. * * @param index The index. * @return The boolean at the given index, or null of the index is undefined. */ public boolean getBoolean(int index) { return get(index).booleanValue(); }
/** * Precondition: The specified key string is the path to a boolean. * Gets the boolean 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. * @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(); }
/** * Precondition: The specified key string is the path to a boolean. Gets the boolean 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. * @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(); }
/** * Precondition: The specified key string is the path to a boolean. Gets the boolean 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. * @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(); }
@Override public SoyData compute(List<SoyData> args) { String text = args.get(0).stringValue(); //noinspection SimplifiableConditionalExpression boolean isHtml = (args.size() == 2) ? args.get(1).booleanValue() : false /* default */; return toSoyData(BidiUtils.estimateDirection(text, isHtml).ord); }
@Override public SoyData compute(List<SoyData> args) { String text = args.get(0).stringValue(); @SuppressWarnings("SimplifiableConditionalExpression") // make IntelliJ happy boolean isHtml = (args.size() == 2) ? args.get(1).booleanValue() : false /* default */; int bidiGlobalDir = bidiGlobalDirProvider.get().getStaticValue(); return UnsafeSanitizedContentOrdainer.ordainAsSafe( SoyBidiUtils.getBidiFormatter(bidiGlobalDir).dirAttr(text, isHtml), SanitizedContent.ContentKind.ATTRIBUTES); }
@Override public SoyData compute(List<SoyData> args) { String text = args.get(0).stringValue(); //noinspection SimplifiableConditionalExpression boolean isHtml = (args.size() == 2) ? args.get(1).booleanValue() : false /* default */; int bidiGlobalDir = bidiGlobalDirProvider.get().getStaticValue(); return toSoyData(SoyBidiUtils.getBidiFormatter(bidiGlobalDir).markAfter(text, isHtml)); }
if (args.size() == 2) { try { doAddEllipsis = args.get(1).booleanValue(); } catch (SoyDataException sde) { throw new IllegalArgumentException(
/** * Converts the input to a JavaScript expression. The resulting expression can be a boolean, * number, string literal, or {@code null}. */ public static String escapeJsValue(SoyData value) { // We surround values with spaces so that they can't be interpolated into identifiers // by accident. We could use parentheses but those might be interpreted as a function call. if (NullData.INSTANCE == value) { // The JS counterpart of this code in soyutils.js emits " null " for both null and the special // JS value undefined. return " null "; } else if (value instanceof NumberData) { // This will emit references to NaN and Infinity. Client code should not redefine those // to store sensitive data. return " " + value.numberValue() + " "; } else if (value instanceof BooleanData) { return " " + value.booleanValue() + " "; } else if (isSanitizedContentOfKind(value, SanitizedContent.ContentKind.JS)) { return value.toString(); } else { return escapeJsValue(value.toString()); } }