private static Boolean validateMemoizeProperties()

in plugin/src/main/groovy/grails/plugins/redis/ast/MemoizeASTTransformation.groovy [31:47]


    private static Boolean validateMemoizeProperties(keyClosure, keyString, ASTNode[] astNodes, SourceUnit sourceUnit, expire) {
        if(keyClosure?.class != ClosureExpression && keyString.class != String) {
            addError('Internal Error: annotation does not contain key closure or key property', astNodes[0], sourceUnit)
            return false
        }

        if(keyClosure && keyClosure.code?.statements[0]?.expression?.value?.class != String) {
            addError('Internal Error: annotation does not contain string key closure', astNodes[0], sourceUnit)
            return false
        }

        if(expire && expire.class != String && !Integer.parseInt(expire)) {
            addError('Internal Error: provided expire is not an String (in millis)', astNodes[0], sourceUnit)
            return false
        }
        true
    }