-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: restored arguments validation
Signed-off-by: Zerumi <46845708+Zerumi@users.noreply.github.com>
- Loading branch information
Showing
18 changed files
with
167 additions
and
355 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
package commandManager.commands; | ||
|
||
/** | ||
* Provides Argument Consumer | ||
* | ||
* @param <T> Argument param | ||
* @author zerumi | ||
* @since 2.1 | ||
*/ | ||
public interface ArgumentConsumer<T> { | ||
void setObj(T obj); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main; | ||
|
||
public class LibUtilities { | ||
public static boolean isNotNumeric(String str) { | ||
return !str.matches("-?\\d+(\\.\\d+)?"); //match a number with optional '-' and decimal. | ||
} | ||
|
||
public static Long handleUserInputID(String input) { | ||
if (LibUtilities.isNotNumeric(input)) { | ||
System.out.println("Provided argument id: \"" + input + "\" is not a number! Try again."); | ||
return null; | ||
} else if (input.contains(".")) { | ||
System.out.println("ID field cannot accept decimal values. Try again."); | ||
return null; | ||
} | ||
|
||
Long id = null; | ||
try { | ||
id = Long.valueOf(input); | ||
} catch (NumberFormatException e) { | ||
System.out.println("Provided argument: \"" + input + "\" is too large for ID field. Try again."); | ||
} | ||
return id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
package main; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
System.out.println(""" | ||
Однажды Вася спросил у своего старшего брата-сеньора Пети: | ||
"Петя, зачем вообще нам нужно запускать общую библиотеку классов?" | ||
На что Петя ответил: "Братиш, для того, чтобы практик на защите прочитал этот текст.\""""); | ||
} | ||
} |
a3029b1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo