First Commit
This commit is contained in:
28
com/nemez/cmdmgr/component/IntegerComponent.java
Normal file
28
com/nemez/cmdmgr/component/IntegerComponent.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.nemez.cmdmgr.component;
|
||||
|
||||
public class IntegerComponent extends ArgumentComponent {
|
||||
|
||||
@Override
|
||||
public Object get(String input) {
|
||||
try {
|
||||
return Integer.parseInt(input);
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean valid(String input) {
|
||||
try {
|
||||
Integer.parseInt(input);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentInfo() {
|
||||
return "<" + argName + ":i32>";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user