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

com.netflix.nebula.lint.rule.dependency.ClassInformation.groovy Maven / Gradle / Ivy

Go to download

Pluggable and configurable linter tool for identifying and reporting on patterns of misuse or deprecations in Gradle scripts

There is a newer version: 20.2.2
Show newest version
package com.netflix.nebula.lint.rule.dependency

import groovy.transform.CompileStatic

@CompileStatic
class ClassInformation {
    String filePath
    String source
    String name

    Collection methodReferences = []

    ClassInformation(String source, String name, Collection methodReferences) {
        this.source = source
        this.name = name
        this.methodReferences = methodReferences
        this.filePath = calculateFilePath(source, name)
    }

    @Override
    String toString() {
        return "source: $source - filePath: $filePath - name: $name - methodReferences: ${methodReferences*.toString().join(' | ')}"
    }

    private String calculateFilePath(String source, String name) {
        String extension = getFileExtension(source)
        return name + extension
    }

    private String getFileExtension(String fileName) {
        int lastIndexOf = fileName.lastIndexOf(".")
        if (lastIndexOf == -1) {
            return ""
        }
        return fileName.substring(lastIndexOf)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy