/** * Parse a string as a standard Git boolean value. See * {@link #toBooleanOrNull(String)}. * * @param stringValue * the string to parse. * @return the boolean interpretation of {@code value}. * @throws java.lang.IllegalArgumentException * if {@code value} is not recognized as one of the standard * boolean names. */ public static boolean toBoolean(String stringValue) { if (stringValue == null) throw new NullPointerException(JGitText.get().expectedBooleanStringValue); final Boolean bool = toBooleanOrNull(stringValue); if (bool == null) throw new IllegalArgumentException(MessageFormat.format(JGitText.get().notABoolean, stringValue)); return bool.booleanValue(); }
private static RenameDetectionType parseRenameDetectionType( final String renameString) { if (renameString == null) return RenameDetectionType.FALSE; else if (StringUtils.equalsIgnoreCase( ConfigConstants.CONFIG_RENAMELIMIT_COPY, renameString) || StringUtils .equalsIgnoreCase( ConfigConstants.CONFIG_RENAMELIMIT_COPIES, renameString)) return RenameDetectionType.COPY; else { final Boolean renameBoolean = StringUtils .toBooleanOrNull(renameString); if (renameBoolean == null) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().enumValueNotSupported2, ConfigConstants.CONFIG_DIFF_SECTION, ConfigConstants.CONFIG_KEY_RENAMES, renameString)); else if (renameBoolean.booleanValue()) return RenameDetectionType.TRUE; else return RenameDetectionType.FALSE; } } }
/** * Parse a string as a standard Git boolean value. See * {@link #toBooleanOrNull(String)}. * * @param stringValue * the string to parse. * @return the boolean interpretation of {@code value}. * @throws IllegalArgumentException * if {@code value} is not recognized as one of the standard * boolean names. */ public static boolean toBoolean(final String stringValue) { if (stringValue == null) throw new NullPointerException(JGitText.get().expectedBooleanStringValue); final Boolean bool = toBooleanOrNull(stringValue); if (bool == null) throw new IllegalArgumentException(MessageFormat.format(JGitText.get().notABoolean, stringValue)); return bool.booleanValue(); }
/** * Parse a string as a standard Git boolean value. See * {@link #toBooleanOrNull(String)}. * * @param stringValue * the string to parse. * @return the boolean interpretation of {@code value}. * @throws java.lang.IllegalArgumentException * if {@code value} is not recognized as one of the standard * boolean names. */ public static boolean toBoolean(String stringValue) { if (stringValue == null) throw new NullPointerException(JGitText.get().expectedBooleanStringValue); final Boolean bool = toBooleanOrNull(stringValue); if (bool == null) throw new IllegalArgumentException(MessageFormat.format(JGitText.get().notABoolean, stringValue)); return bool.booleanValue(); }
private static RenameDetectionType parseRenameDetectionType( final String renameString) { if (renameString == null) return RenameDetectionType.FALSE; else if (StringUtils.equalsIgnoreCase( ConfigConstants.CONFIG_RENAMELIMIT_COPY, renameString) || StringUtils .equalsIgnoreCase( ConfigConstants.CONFIG_RENAMELIMIT_COPIES, renameString)) return RenameDetectionType.COPY; else { final Boolean renameBoolean = StringUtils .toBooleanOrNull(renameString); if (renameBoolean == null) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().enumValueNotSupported2, ConfigConstants.CONFIG_DIFF_SECTION, ConfigConstants.CONFIG_KEY_RENAMES, renameString)); else if (renameBoolean.booleanValue()) return RenameDetectionType.TRUE; else return RenameDetectionType.FALSE; } } }
private static RenameDetectionType parseRenameDetectionType( final String renameString) { if (renameString == null) return RenameDetectionType.FALSE; else if (StringUtils.equalsIgnoreCase( ConfigConstants.CONFIG_RENAMELIMIT_COPY, renameString) || StringUtils .equalsIgnoreCase( ConfigConstants.CONFIG_RENAMELIMIT_COPIES, renameString)) return RenameDetectionType.COPY; else { final Boolean renameBoolean = StringUtils .toBooleanOrNull(renameString); if (renameBoolean == null) throw new IllegalArgumentException(MessageFormat.format( JGitText.get().enumValueNotSupported2, ConfigConstants.CONFIG_DIFF_SECTION, ConfigConstants.CONFIG_KEY_RENAMES, renameString)); else if (renameBoolean.booleanValue()) return RenameDetectionType.TRUE; else return RenameDetectionType.FALSE; } } }