
de.is24.deadcode4j.Resource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deadcode4j-maven-plugin Show documentation
Show all versions of deadcode4j-maven-plugin Show documentation
Finds unused classes of a project
package de.is24.deadcode4j;
import com.google.common.base.Optional;
import java.io.File;
/**
* A Resource
represents a required artifact/dependency of a Module
.
* It can be a mere class path entry or a Module
which is part of the analysis.
*
* @since 2.0.0
*/
public abstract class Resource {
public static Resource of(final File file) {
return new Resource() {
@Override
public Optional getClassPathEntry() {
return Optional.of(file);
}
@Override
public Optional getReferencedModule() {
return Optional.absent();
}
};
}
public static Resource of(final Module module) {
return new Resource() {
@Override
public Optional getClassPathEntry() {
Repository repository = module.getOutputRepository();
return repository != null ? Optional.of(repository.getDirectory()) : Optional.absent();
}
@Override
public Optional getReferencedModule() {
return Optional.of(module);
}
};
}
public abstract Optional getClassPathEntry();
public abstract Optional getReferencedModule();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy