private void assertInvariant() { Assert.ensure(mSpeechRecognition != null || mDtmfRecognition != null, "Must provide a non-null configuration for speech or DTMF"); }
public static void positive(long value, String symbol) { ensure(value > 0, symbol + " should be positive. Value=" + value); }
public static void notNegative(long value, String symbol) { ensure(value >= 0, symbol + " should not be negative. Value=" + value); }
/** * @param termChar The terminating DTMF character for DTMF input * recognition. Must be empty or a single character. * <code>null</code> to use the VoiceXML platform default * @see <a * href="https://www.w3.org/TR/voicexml20/#dml6.3.3">https://www.w3.org/TR/voicexml20/#dml6.3.3</a> */ public void setTermChar(String termChar) { if (termChar != null) { Assert.ensure(termChar.equals("") || termChar.length() == 1, "Termchar must be empty or single character"); } mTermChar = termChar; }
public static void noNullValues(Collection<?> collection, String symbol) { Assert.notNull(collection, symbol); for (Object item : collection) { ensure(item != null, symbol + " should not contain null values."); } }
public static void noNullValues(Object[] array, String symbol) { Assert.notNull(array, symbol); int index = 0; for (Object item : array) { ensure(item != null, symbol + "[" + index + "] should not be null."); index++; } }
public static void notEmpty(String string, String symbol) { notNull(string, symbol); ensure(!string.isEmpty(), symbol + " should not be empty."); }
public static void noNullValues(List<?> list, String symbol) { Assert.notNull(list, symbol); int index = 0; for (Object item : list) { ensure(item != null, "item #" + index + " of " + symbol + " should not be null."); index++; } }
public static void notEmpty(Collection<?> collection, String symbol) { notNull(collection, symbol); ensure(!collection.isEmpty(), symbol + " should not be empty."); }
public void addWithExpression(String name, String initialExpression) { Assert.notNull(name, "name"); Assert.ensure(VoiceXmlUtils.isValidIdentifierName(name), "Invalid ECMAScript identifier name: '" + name + "'"); mVariables.put(name, initialExpression); }
public void addWithString(String name, String string) { Assert.notNull(name, "name"); Assert.ensure(VoiceXmlUtils.isValidIdentifierName(name), "Invalid ECMAScript identifier name: '" + name + "'"); Assert.notNull(string, "string"); mVariables.put(name, VoiceXmlDomUtil.createEcmaScriptStringLiteral(string)); }
/** * Builds the interaction. This method adds a speech and DTMF * recognition window after the prompts. * * @param speechRecognition configuration for the speech recognition * @param dtmfRecognition configuration for the DTMF recognition * @param noinputTimeout timeout value before a <code>noinput</code> is * generated. * @param acknowledgeAudioItems audioItems to be played upon recognition * @return the interaction */ public Interaction build(DtmfRecognition dtmfRecognition, SpeechRecognition speechRecognition, Duration noinputTimeout, List<? extends AudioItem> acknowledgeAudioItems) { Assert.ensure(dtmfRecognition != null || speechRecognition != null, "Must provide at least one recognition configuration (speech or DTMF)"); checkBuilt(); FinalRecognitionWindow finalRecognitionWindow = new FinalRecognitionWindow(dtmfRecognition, speechRecognition, noinputTimeout); if (acknowledgeAudioItems != null) { finalRecognitionWindow.setAcknowledgeAudioItems(acknowledgeAudioItems); } return new Interaction(mName, mPrompts, finalRecognitionWindow); }