// Path: src/main/java/com/statemachinesystems/envy/ValueParser.java
// public interface ValueParser<T> {
// 
//     /**
//      * Parse the given string into a value of the required type.
//      *
//      * @param value  the string to parse
//      * @return       a value of the required type
//      */
//     T parseValue(String value);
// 
//     /**
//      * Provide the type required by this parser.
//      *
//      * @return  a {@link java.lang.Class} object representing the required type
//      */
//     Class<T> getValueClass();
// }


import com.statemachinesystems.envy.ValueParser;
import java.net.InetSocketAddress;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package com.statemachinesystems.envy.parsers;



/**
 * {@link ValueParser} implementation for {@link java.net.InetSocketAddress} values.
 */
public class InetSocketAddressValueParser implements ValueParser<InetSocketAddress> {

    private static final Pattern HOST_AND_PORT = Pattern.compile("(.*):(\\d+)$");

    @Override
    public InetSocketAddress parseValue(String value) {
        Matcher matcher = HOST_AND_PORT.matcher(value);
        if (! matcher.matches()) {
            throw new IllegalArgumentException("Can't parse InetSocketAddress from " + value);
        }
        String host = matcher.group(1);
// Path: src/main/java/com/statemachinesystems/envy/ValueParser.java
// public interface ValueParser<T> {
// 
//     /**
//      * Parse the given string into a value of the required type.
//      *
//      * @param value  the string to parse
//      * @return       a value of the required type
//      */
//     T parseValue(String value);
// 
//     /**
//      * Provide the type required by this parser.
//      *
//      * @return  a {@link java.lang.Class} object representing the required type
//      */
//     Class<T> getValueClass();
// }


// Path: src/main/java/com/statemachinesystems/envy/parsers/InetSocketAddressValueParser.java
import com.statemachinesystems.envy.ValueParser;
import java.net.InetSocketAddress;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

package com.statemachinesystems.envy.parsers;



/**
 * {@link ValueParser} implementation for {@link java.net.InetSocketAddress} values.
 */
public class InetSocketAddressValueParser implements ValueParser<InetSocketAddress> {

    private static final Pattern HOST_AND_PORT = Pattern.compile("(.*):(\\d+)$");

    @Override
    public InetSocketAddress parseValue(String value) {
        Matcher matcher = HOST_AND_PORT.matcher(value);
        if (! matcher.matches()) {
            throw new IllegalArgumentException("Can't parse InetSocketAddress from " + value);
        }
        String host = matcher.group(1);
        int port = Integer.parseInt(matcher.group(2));