/** * @param blamedAssignmentTargetVarName * Used for assignments that use {@code +=} and such, in which case the {@code blamed} expression * parameter will be null {@code null} and this parameter will be non-{null}. */ private static _ErrorDescriptionBuilder newDesciptionBuilder( Expression blamed, String blamedAssignmentTargetVarName, TemplateModel model, String expectedTypesDesc, Class[] expectedTypes, Environment env) throws InvalidReferenceException { if (model == null) throw InvalidReferenceException.getInstance(blamed, env); _ErrorDescriptionBuilder errorDescBuilder = new _ErrorDescriptionBuilder( unexpectedTypeErrorDescription(expectedTypesDesc, blamed, blamedAssignmentTargetVarName, model)) .blame(blamed).showBlamer(true); if (model instanceof _UnexpectedTypeErrorExplainerTemplateModel) { Object[] tip = ((_UnexpectedTypeErrorExplainerTemplateModel) model).explainTypeError(expectedTypes); if (tip != null) { errorDescBuilder.tip(tip); } } if (model instanceof TemplateCollectionModel && (Arrays.asList(expectedTypes).contains(TemplateSequenceModel.class) || Arrays.asList(expectedTypes).contains(TemplateCollectionModelEx.class))) { errorDescBuilder.tip("As the problematic value contains a collection of items, you could convert it " + "to a sequence like someValue?sequence. Be sure though that you won't have a large number of " + "items, as all will be held in memory one the same time."); } return errorDescBuilder; }
/** * @param blamedAssignmentTargetVarName * Used for assignments that use {@code +=} and such, in which case the {@code blamed} expression * parameter will be null {@code null} and this parameter will be non-{null}. */ private static _ErrorDescriptionBuilder newDesciptionBuilder( Expression blamed, String blamedAssignmentTargetVarName, TemplateModel model, String expectedTypesDesc, Class[] expectedTypes, Environment env) throws InvalidReferenceException { if (model == null) throw InvalidReferenceException.getInstance(blamed, env); _ErrorDescriptionBuilder errorDescBuilder = new _ErrorDescriptionBuilder( unexpectedTypeErrorDescription(expectedTypesDesc, blamed, blamedAssignmentTargetVarName, model)) .blame(blamed).showBlamer(true); if (model instanceof _UnexpectedTypeErrorExplainerTemplateModel) { Object[] tip = ((_UnexpectedTypeErrorExplainerTemplateModel) model).explainTypeError(expectedTypes); if (tip != null) { errorDescBuilder.tip(tip); } } if (model instanceof TemplateCollectionModel && (Arrays.asList(expectedTypes).contains(TemplateSequenceModel.class) || Arrays.asList(expectedTypes).contains(TemplateCollectionModelEx.class))) { errorDescBuilder.tip("As the problematic value contains a collection of items, you could convert it " + "to a sequence like someValue?sequence. Be sure though that you won't have a large number of " + "items, as all will be held in memory one the same time."); } return errorDescBuilder; }
/** * @param blamedAssignmentTargetVarName * Used for assignments that use {@code +=} and such, in which case the {@code blamed} expression * parameter will be null {@code null} and this parameter will be non-{null}. */ private static _ErrorDescriptionBuilder newDesciptionBuilder( Expression blamed, String blamedAssignmentTargetVarName, TemplateModel model, String expectedTypesDesc, Class[] expectedTypes, Environment env) throws InvalidReferenceException { if (model == null) throw InvalidReferenceException.getInstance(blamed, env); _ErrorDescriptionBuilder errorDescBuilder = new _ErrorDescriptionBuilder( unexpectedTypeErrorDescription(expectedTypesDesc, blamed, blamedAssignmentTargetVarName, model)) .blame(blamed).showBlamer(true); if (model instanceof _UnexpectedTypeErrorExplainerTemplateModel) { Object[] tip = ((_UnexpectedTypeErrorExplainerTemplateModel) model).explainTypeError(expectedTypes); if (tip != null) { errorDescBuilder.tip(tip); } } if (model instanceof TemplateCollectionModel && (Arrays.asList(expectedTypes).contains(TemplateSequenceModel.class) || Arrays.asList(expectedTypes).contains(TemplateCollectionModelEx.class))) { errorDescBuilder.tip("As the problematic value contains a collection of items, you could convert it " + "to a sequence like someValue?sequence. Be sure though that you won't have a large number of " + "items, as all will be held in memory one the same time."); } return errorDescBuilder; }