@Test public void shouldConvertToJson() { TextInputCallback textInputCallback = new TextInputCallback("Enter text:", "DEFAULT_VALUE"); JsonValue jsonObject = restAuthTextInputCallbackHandler.convertToJson(textInputCallback, 1); assertEquals("TextInputCallback", jsonObject.get("type").asString()); assertNotNull(jsonObject.get("output")); assertEquals(2, jsonObject.get("output").size()); assertEquals("Enter text:", jsonObject.get("output").get(0).get("value").asString()); assertEquals("DEFAULT_VALUE", jsonObject.get("output").get(1).get("value").asString()); assertNotNull(jsonObject.get("input")); assertEquals(1, jsonObject.get("input").size()); assertEquals("", jsonObject.get("input").get(0).get("value").asString()); }
public JsonValue convertToJson(TextInputCallback callback, int index) { String prompt = callback.getPrompt(); String defaultText = callback.getDefaultText(); String text = callback.getText(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("prompt", prompt)) .addLast(createOutputField("defaultText", defaultText)) .array("input") .addLast(createInputField(index, text)) .build(); return jsonValue; }
RestAuthTextInputCallbackHandler extends AbstractRestAuthCallbackHandler<TextInputCallback> { public JsonValue convertToJson(TextInputCallback callback, int index) { String prompt = callback.getPrompt(); String defaultText = callback.getDefaultText(); String text = callback.getText(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("prompt", prompt)) .addLast(createOutputField("defaultText", defaultText)) .array("input") .addLast(createInputField(index, text)) .build(); return jsonValue; } }
RestAuthTextInputCallbackHandler extends AbstractRestAuthCallbackHandler<TextInputCallback> { public JsonValue convertToJson(TextInputCallback callback, int index) { String prompt = callback.getPrompt(); String defaultText = callback.getDefaultText(); String text = callback.getText(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("prompt", prompt)) .addLast(createOutputField("defaultText", defaultText)) .array("input") .addLast(createInputField(index, text)) .build(); return jsonValue; }  }
RestAuthTextInputCallbackHandler extends AbstractRestAuthCallbackHandler<TextInputCallback> { public JsonValue convertToJson(TextInputCallback callback, int index) { String prompt = callback.getPrompt(); String defaultText = callback.getDefaultText(); String text = callback.getText(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("prompt", prompt)) .addLast(createOutputField("defaultText", defaultText)) .array("input") .addLast(createInputField(index, text)) .build(); return jsonValue; }  TextInputCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response,
            JsonValue postBody, TextInputCallback originalCallback); String getCallbackClassName(); JsonValue convertToJson(TextInputCallback callback, int index); TextInputCallback convertFromJson(TextInputCallback callback, JsonValue jsonCallback); }
RestAuthTextInputCallbackHandler extends AbstractRestAuthCallbackHandler<TextInputCallback> { public JsonValue convertToJson(TextInputCallback callback, int index) { String prompt = callback.getPrompt(); String defaultText = callback.getDefaultText(); String text = callback.getText(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("prompt", prompt)) .addLast(createOutputField("defaultText", defaultText)) .array("input") .addLast(createInputField(index, text)) .build(); return jsonValue; }  TextInputCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response,
            JsonValue postBody, TextInputCallback originalCallback); String getCallbackClassName(); JsonValue convertToJson(TextInputCallback callback, int index); TextInputCallback convertFromJson(TextInputCallback callback, JsonValue jsonCallback);  }