Class ContainerFileResolver
java.lang.Object
com.buschmais.jqassistant.plugin.common.api.scanner.AbstractFileResolver
com.buschmais.jqassistant.plugin.common.api.scanner.ContainerFileResolver
- All Implemented Interfaces:
FileResolver
A file resolver strategy for file containers.
-
Constructor Summary
ConstructorsConstructorDescriptionContainerFileResolver(ScannerContext scannerContext, FileContainerDescriptor fileContainerDescriptor) -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Flush the caches to the store.<D extends FileDescriptor>
Dmatch(String containedPath, Class<D> type, ScannerContext context) Match an existing descriptor in the store and return it with as the given type if it exists.voidput(String path, FileDescriptor fileDescriptor) Adds a file to the container.<D extends FileDescriptor>
Drequire(String requiredPath, String containedPath, Class<D> type, ScannerContext context) Resolve an existing file descriptor for the given paths.intsize()Returns the size of the container.Methods inherited from class com.buschmais.jqassistant.plugin.common.api.scanner.AbstractFileResolver
getOrCreateAs, require, toFileDescriptor
-
Constructor Details
-
ContainerFileResolver
public ContainerFileResolver(ScannerContext scannerContext, FileContainerDescriptor fileContainerDescriptor)
-
-
Method Details
-
require
public <D extends FileDescriptor> D require(String requiredPath, String containedPath, Class<D> type, ScannerContext context) Description copied from interface:FileResolverResolve an existing file descriptor for the given paths.This is usually done by evaluating the given path, e.g. if a path "com/buschmais/Test.class" is given a class file resolver might return an existing class descriptor with the fully qualified name "com.buschmais.Test" which has been created before as a referenced class.
- Parameters:
requiredPath- The path of the file to require, e.g. /com/acme/Example.classcontainedPath- The internal path (e.g. within the the same artifact if applicable), e.g. /WEB-INF/classes/com/acme/Example.classtype- The file descriptor type.context- The scanner context.- Returns:
- The resolved file descriptor.
-
match
public <D extends FileDescriptor> D match(String containedPath, Class<D> type, ScannerContext context) Description copied from interface:FileResolverMatch an existing descriptor in the store and return it with as the given type if it exists.Example: A Java class might exist with a fully qualified name in the database. The implementation of this method should check if the given path can be transformed into a class name (i.e. replacing '/' with '.') that already exists as descriptor (i.e. node) and return it.
- Type Parameters:
D- The expected type.- Parameters:
containedPath- The path.type- The expected type.context- The scanner context.- Returns:
- The matching descriptor.
-
flush
public void flush()Flush the caches to the store. -
put
Adds a file to the container.- Parameters:
path- The path of the file.fileDescriptor- The file descriptor.
-
size
public int size()Returns the size of the container.- Returns:
- The size of the container.
-