/** * Gets an {@code Optional<DBType>} which matches {@code name}.<p> * This method is case-insensitive.<p> * The {@code Optional<DBType>} is empty when no {@code DBType} is found. * * @param name the name of the {@code DBType} * @return an {@code Optional<DBType>} */ public static Optional<DBType> getForName(String name) { for (DBType dbType : DBType.values()) { if (dbType.getName().equalsIgnoreCase(name)) { return Optional.of(dbType); } } return Optional.empty(); }
/** * Checks if the name of a {@code DBType} corresponds to {@code name}.<p> * This method is case-insensitive. * * @param name the name of the {@code DBType} * @return if the {@code DBType} exists * @see DBType#getForName(String) */ public static boolean exists(String name) { for (DBType dbType : DBType.values()) { if (dbType.getName().equalsIgnoreCase(name)) { return true; } } return false; } }