public static TemplateModelException newMethodArgUnexpectedTypeException( String methodName, int argIdx, String expectedType, TemplateModel arg) { return new _TemplateModelException( methodName, "(...) expects ", new _DelayedAOrAn(expectedType), " as argument #", Integer.valueOf(argIdx + 1), ", but received ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(arg)), "."); }
private static Object[] unexpectedTypeErrorDescription( String expectedTypesDesc, Expression blamed, String blamedAssignmentTargetVarName, TemplateModel model) { return new Object[] { "Expected ", new _DelayedAOrAn(expectedTypesDesc), ", but ", (blamedAssignmentTargetVarName == null ? (Object) (blamed != null ? "this" : "the expression") : new Object[] { "assignment target variable ", new _DelayedJQuote(blamedAssignmentTargetVarName) }), " has evaluated to ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(model)), (blamed != null ? ":" : ".")}; }
public static TemplateModelException newKeyValuePairListingNonStringKeyExceptionMessage( TemplateModel key, TemplateHashModelEx listedHashEx) { return new _TemplateModelException(new _ErrorDescriptionBuilder( "When listing key-value pairs of traditional hash " + "implementations, all keys must be strings, but one of them " + "was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(key)), "." ).tip("The listed value's TemplateModel class was ", new _DelayedShortClassName(listedHashEx.getClass()), ", which doesn't implement ", new _DelayedShortClassName(TemplateHashModelEx2.class), ", which leads to this restriction.")); }
private boolean getBooleanOption(String optionName, TemplateModel value) throws TemplateModelException { if (!(value instanceof TemplateBooleanModel)) { throw _MessageUtil.newMethodArgInvalidValueException(methodName, 1, "The value of the ", new _DelayedJQuote(optionName), " option must be a boolean, but it was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(value)), "."); } return ((TemplateBooleanModel) value).getAsBoolean(); }
private String getStringOption(String optionName, TemplateModel value) throws TemplateModelException { if (!(value instanceof TemplateScalarModel)) { throw _MessageUtil.newMethodArgInvalidValueException(methodName, 1, "The value of the ", new _DelayedJQuote(optionName), " option must be a string, but it was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(value)), "."); } return EvalUtil.modelToString((TemplateScalarModel) value, null, null); }
throw new NonSequenceOrCollectionException(env, new _ErrorDescriptionBuilder("The value you try to list is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(listedValue)), ", thus you must specify two loop variables after the \"as\"; one for the key, and " + "another for the value, like ", "<#... as k, v>", ")."
? new Object[] { "(", new _DelayedGetCanonicalForm(leftExp), ") value " } : (Object) ""), "is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(leftValue)), ".\n", "Right hand operand ", (quoteOperandsInErrors && rightExp != null ? new Object[] { "(", new _DelayedGetCanonicalForm(rightExp), ") value " } : (Object) ""), "is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(rightValue)), ".");
throw new NonSequenceOrCollectionException(env, new _ErrorDescriptionBuilder("The value you try to list is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(listedValue)), ", thus you must specify only one loop variable after the \"as\" (there's no separate " + "key and value)."
throw _MessageUtil.newMethodArgInvalidValueException(methodName, 1, "All keys in the options hash must be strings, but found ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(optNameTM)));
public static TemplateModelException newMethodArgUnexpectedTypeException( String methodName, int argIdx, String expectedType, TemplateModel arg) { return new _TemplateModelException( methodName, "(...) expects ", new _DelayedAOrAn(expectedType), " as argument #", Integer.valueOf(argIdx + 1), ", but received ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(arg)), "."); }
public static TemplateModelException newMethodArgUnexpectedTypeException( String methodName, int argIdx, String expectedType, TemplateModel arg) { return new _TemplateModelException( methodName, "(...) expects ", new _DelayedAOrAn(expectedType), " as argument #", Integer.valueOf(argIdx + 1), ", but received ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(arg)), "."); }
private static Object[] unexpectedTypeErrorDescription( String expectedTypesDesc, Expression blamed, String blamedAssignmentTargetVarName, TemplateModel model) { return new Object[] { "Expected ", new _DelayedAOrAn(expectedTypesDesc), ", but ", (blamedAssignmentTargetVarName == null ? (Object) (blamed != null ? "this" : "the expression") : new Object[] { "assignment target variable ", new _DelayedJQuote(blamedAssignmentTargetVarName) }), " has evaluated to ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(model)), (blamed != null ? ":" : ".")}; }
private static Object[] unexpectedTypeErrorDescription( String expectedTypesDesc, Expression blamed, String blamedAssignmentTargetVarName, TemplateModel model) { return new Object[] { "Expected ", new _DelayedAOrAn(expectedTypesDesc), ", but ", (blamedAssignmentTargetVarName == null ? (Object) (blamed != null ? "this" : "the expression") : new Object[] { "assignment target variable ", new _DelayedJQuote(blamedAssignmentTargetVarName) }), " has evaluated to ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(model)), (blamed != null ? ":" : ".")}; }
public static TemplateModelException newKeyValuePairListingNonStringKeyExceptionMessage( TemplateModel key, TemplateHashModelEx listedHashEx) { return new _TemplateModelException(new _ErrorDescriptionBuilder( "When listing key-value pairs of traditional hash " + "implementations, all keys must be strings, but one of them " + "was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(key)), "." ).tip("The listed value's TemplateModel class was ", new _DelayedShortClassName(listedHashEx.getClass()), ", which doesn't implement ", new _DelayedShortClassName(TemplateHashModelEx2.class), ", which leads to this restriction.")); }
public static TemplateModelException newKeyValuePairListingNonStringKeyExceptionMessage( TemplateModel key, TemplateHashModelEx listedHashEx) { return new _TemplateModelException(new _ErrorDescriptionBuilder( "When listing key-value pairs of traditional hash " + "implementations, all keys must be strings, but one of them " + "was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(key)), "." ).tip("The listed value's TemplateModel class was ", new _DelayedShortClassName(listedHashEx.getClass()), ", which doesn't implement ", new _DelayedShortClassName(TemplateHashModelEx2.class), ", which leads to this restriction.")); }
private String getStringOption(String optionName, TemplateModel value) throws TemplateModelException { if (!(value instanceof TemplateScalarModel)) { throw _MessageUtil.newMethodArgInvalidValueException(methodName, 1, "The value of the ", new _DelayedJQuote(optionName), " option must be a string, but it was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(value)), "."); } return EvalUtil.modelToString((TemplateScalarModel) value, null, null); }
private boolean getBooleanOption(String optionName, TemplateModel value) throws TemplateModelException { if (!(value instanceof TemplateBooleanModel)) { throw _MessageUtil.newMethodArgInvalidValueException(methodName, 1, "The value of the ", new _DelayedJQuote(optionName), " option must be a boolean, but it was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(value)), "."); } return ((TemplateBooleanModel) value).getAsBoolean(); }
private boolean getBooleanOption(String optionName, TemplateModel value) throws TemplateModelException { if (!(value instanceof TemplateBooleanModel)) { throw _MessageUtil.newMethodArgInvalidValueException(methodName, 1, "The value of the ", new _DelayedJQuote(optionName), " option must be a boolean, but it was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(value)), "."); } return ((TemplateBooleanModel) value).getAsBoolean(); }
private String getStringOption(String optionName, TemplateModel value) throws TemplateModelException { if (!(value instanceof TemplateScalarModel)) { throw _MessageUtil.newMethodArgInvalidValueException(methodName, 1, "The value of the ", new _DelayedJQuote(optionName), " option must be a string, but it was ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(value)), "."); } return EvalUtil.modelToString((TemplateScalarModel) value, null, null); }
throw new NonSequenceOrCollectionException(env, new _ErrorDescriptionBuilder("The value you try to list is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(listedValue)), ", thus you must specify two loop variables after the \"as\"; one for the key, and " + "another for the value, like ", "<#... as k, v>", ")."