All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hidetake.groovy.ssh.interaction.MatchResult.groovy Maven / Gradle / Ivy

There is a newer version: 2.11.2
Show newest version
package org.hidetake.groovy.ssh.interaction

import java.util.regex.Matcher

class MatchResult {

    private final Rule rule
    private final E result

    def MatchResult(Rule rule1, E result1) {
        rule = rule1
        result = result1
    }

    def getActionWithResult() {
        rule.action.curry(result)
    }

    def getResultAsString() {
        if (result instanceof Matcher) {
            result.group()
        } else if (result instanceof byte[]) {
            "byte[$result.length]"
        } else {
            result.toString()
        }
    }

    @Override
    String toString() {
        "$rule -> $resultAsString"
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy