@Override public String toString() { throw new SoyDataException("Attempted to coerce undefined value into a string."); }
@Override public String toString() { throw new SoyDataException("Attempted to coerce undefined value into a string."); }
@Override public double floatValue() { throw new SoyDataException( "Expecting float value but instead encountered type " + getClass().getSimpleName()); }
@Override public boolean booleanValue() { throw new SoyDataException( "Expecting boolean value but instead encountered type " + getClass().getSimpleName()); }
@Override public double numberValue() { throw new SoyDataException( "Expecting number value but instead encountered type " + getClass().getSimpleName()); }
@Override public double numberValue() { throw new SoyDataException( "Expecting number value but instead encountered type " + getClass().getSimpleName()); }
/** * Precondition: Only call this method if you know that this SoyData object is a float. * This method gets the float value of this float object. * @return The float value of this float object. * @throws SoyDataException If this object is not actually a float. */ public double floatValue() { throw new SoyDataException("Expecting float value but instead encountered type " + getClass().getSimpleName()); }
/** * Precondition: Only call this method if you know that this SoyData object is a number. * This method gets the float value of this number object (converting integer to float if * necessary). * @return The float value of this number object. * @throws SoyDataException If this object is not actually a number. */ public double numberValue() { throw new SoyDataException("Expecting number value but instead encountered type " + getClass().getSimpleName()); }
/** * Precondition: Only call this method if you know that this SoyData object is a string. * This method gets the string value of this string object. * @return The string value of this string object. * @throws SoyDataException If this object is not actually a string. */ public String stringValue() { throw new SoyDataException("Expecting string value but instead encountered type " + getClass().getSimpleName()); }
@Override public boolean booleanValue() { throw new SoyDataException( "Expecting boolean value but instead encountered type " + getClass().getSimpleName()); }
@Override public int integerValue() { throw new SoyDataException( "Expecting integer value but instead encountered type " + getClass().getSimpleName()); }
@Override public String stringValue() { throw new SoyDataException( "Expecting string value but instead encountered type " + getClass().getSimpleName()); } }
@Override public int integerValue() { throw new SoyDataException( "Expecting integer value but instead encountered type " + getClass().getSimpleName()); }
@Override public double floatValue() { throw new SoyDataException( "Expecting float value but instead encountered type " + getClass().getSimpleName()); }
@Override public String stringValue() { throw new SoyDataException( "Expecting string value but instead encountered type " + getClass().getSimpleName()); } }
private SoyValueProvider convertNonPrimitive(@Nullable Object obj) { SoyValueProvider converted = expensiveConverterMap.convert(obj); if (converted != null) { return converted; } throw new SoyDataException( "Attempting to convert unrecognized object to Soy value (object type " + obj.getClass().getName() + ")."); }
private String getStringKey(SoyValue key) { try { return key.stringValue(); } catch (SoyDataException e) { throw new SoyDataException( "SoyDict accessed with non-string key (got key type " + key.getClass().getName() + ")."); } }
private SoyValueProvider convertNonPrimitive(@Nullable Object obj) { SoyValueProvider converted = expensiveConverterMap.convert(obj); if (converted != null) { return converted; } throw new SoyDataException( "Attempting to convert unrecognized object to Soy value (object type " + obj.getClass().getName() + ")."); }
private String getStringKey(SoyValue key) { try { return key.stringValue(); } catch (SoyDataException e) { throw new SoyDataException( "SoyDict accessed with non-string key (got key type " + key.getClass().getName() + ")."); } }
private SoyValue visitCheckNotNullFunction(ExprNode child) { SoyValue childValue = visit(child); if (childValue instanceof NullData || childValue instanceof UndefinedData) { throw new SoyDataException(child.toSourceString() + " is null"); } return childValue; }