Class DemoHelper
java.lang.Object
org.newsclub.net.unix.demo.DemoHelper
Just a helper class to simplify controlling the demo from the command line.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddProperty(Properties props, String key, String defaultValue, String property, String exampleValue) Adds a key-value pair to a Properties instance.static SocketconnectSocket(SocketAddress socketAddress) static StringgetPropertyValue(String property, String defaultValue, String exampleValue) static <R> RgetPropertyValue(String variable, String property, String defaultValue, String exampleValue, Function<String, R> valueConverter) static <R> RgetPropertyValue(String property, String defaultValue, String exampleValue, Function<String, R> valueConverter) static voidinitJDBCDriverClass(String property, String defaultValue, String exampleValue) static SocketAddressparseAddress(String[] args, SocketAddress defaultAddress) static SocketAddressparseAddress(String opt, String val, SocketAddress defaultAddress) static SocketAddresssocketAddress(String socketName)
-
Method Details
-
addProperty
public static void addProperty(Properties props, String key, String defaultValue, String property, String exampleValue) Adds a key-value pair to a Properties instance. Takes values from a given system property and overrides the default value with it.- Parameters:
props- The Properties instance to write to.key- The name of the property.defaultValue- The default value (for demo purposes)property- The name of the system property that can override the default value.exampleValue- An example value that is different from the default.
-
initJDBCDriverClass
public static void initJDBCDriverClass(String property, String defaultValue, String exampleValue) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
getPropertyValue
-
getPropertyValue
-
getPropertyValue
-
socketAddress
- Throws:
IOException
-
connectSocket
- Throws:
IOException
-
parseAddress
public static SocketAddress parseAddress(String[] args, SocketAddress defaultAddress) throws IOException - Throws:
IOException
-
parseAddress
public static SocketAddress parseAddress(String opt, String val, SocketAddress defaultAddress) throws IOException - Throws:
IOException
-