@Test public void getIntegerAnswerValueFromIAnswerDataTest() { assertNull(StringWidgetUtils.getIntegerAnswerValueFromIAnswerData(null)); assertEquals(Integer.valueOf(0), StringWidgetUtils.getIntegerAnswerValueFromIAnswerData(new IntegerData(0))); assertEquals(Integer.valueOf(-15), StringWidgetUtils.getIntegerAnswerValueFromIAnswerData(new IntegerData(-15))); assertEquals(Integer.valueOf(15), StringWidgetUtils.getIntegerAnswerValueFromIAnswerData(new IntegerData(15))); }
@SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") public static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Double ? ((Double) dataValue).intValue() : (Integer) dataValue; } } return null; }
StringWidgetUtils { @SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") public static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Double ? ((Double) dataValue).intValue() : (Integer) dataValue; } } return null; } }
StringWidgetUtils { @SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") public static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Double ? ((Double) dataValue).intValue() : (Integer) dataValue; } } return null; } private  StringWidgetUtils(); }
StringWidgetUtils { @SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") public static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Double ? ((Double) dataValue).intValue() : (Integer) dataValue; } } return null; } private  StringWidgetUtils(); @SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder); @SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder); static IntegerData getIntegerData(String answer, FormEntryPrompt prompt); static DecimalData getDecimalData(String answer, FormEntryPrompt prompt); static StringData getStringNumberData(String answer, FormEntryPrompt prompt); static void adjustEditTextAnswerToIntegerWidget(EditText answerText, FormEntryPrompt prompt); static void adjustEditTextAnswerToDecimalWidget(EditText answerText, FormEntryPrompt prompt); static void adjustEditTextAnswerToStringNumberWidget(EditText answerText, FormEntryPrompt prompt); }
StringWidgetUtils { @SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") public static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder) { if (dataHolder != null) { Object dataValue = dataHolder.getValue(); if (dataValue != null) { return dataValue instanceof Double ? ((Double) dataValue).intValue() : (Integer) dataValue; } } return null; } private  StringWidgetUtils(); @SuppressFBWarnings("BX_UNBOXING_IMMEDIATELY_REBOXED") static Integer getIntegerAnswerValueFromIAnswerData(IAnswerData dataHolder); @SuppressFBWarnings({"BX_UNBOXING_IMMEDIATELY_REBOXED", "BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR"}) static Double getDoubleAnswerValueFromIAnswerData(IAnswerData dataHolder); static IntegerData getIntegerData(String answer, FormEntryPrompt prompt); static DecimalData getDecimalData(String answer, FormEntryPrompt prompt); static StringData getStringNumberData(String answer, FormEntryPrompt prompt); static void adjustEditTextAnswerToIntegerWidget(EditText answerText, FormEntryPrompt prompt); static void adjustEditTextAnswerToDecimalWidget(EditText answerText, FormEntryPrompt prompt); static void adjustEditTextAnswerToStringNumberWidget(EditText answerText, FormEntryPrompt prompt);  }