Class Location
- java.lang.Object
-
- com.tngtech.archunit.core.importer.Location
-
public abstract class Location extends java.lang.ObjectHandles various forms of location from where classes can be imported in a consistent way. Any location will be treated like anURI, thus there will not be any platform dependent file separator problems.
Examples for locations could befile:///home/someuser/workspace/myproject/target/classes/myproject/Foo.classjar:file:///home/someuser/.m2/repository/myproject/foolib.jar!/myproject/Foo.class
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.net.URIasURI()booleancontains(java.lang.String part)booleanequals(java.lang.Object obj)inthashCode()abstract booleanisArchive()This is a generalization ofisJar().abstract booleanisJar()booleanmatches(java.util.regex.Pattern pattern)static Locationof(java.net.URI uri)static Locationof(java.net.URL url)static Locationof(java.nio.file.Path path)static Locationof(java.util.jar.JarFile jar)java.lang.StringtoString()
-
-
-
Method Detail
-
asURI
@PublicAPI(usage=ACCESS) public java.net.URI asURI()
-
contains
@PublicAPI(usage=ACCESS) public boolean contains(java.lang.String part)
- Parameters:
part- A part to check the respective locationURIfor- Returns:
- true, if the respective
URIcontains the given part
-
matches
@PublicAPI(usage=ACCESS) public boolean matches(java.util.regex.Pattern pattern)
- Parameters:
pattern- A pattern to compare the respective locationURIagainst- Returns:
- true, if the respective
URImatches the given pattern
-
isJar
@PublicAPI(usage=ACCESS) public abstract boolean isJar()
-
isArchive
@PublicAPI(usage=ACCESS) public abstract boolean isArchive()
This is a generalization ofisJar(). Before JDK 9, the only archives were Jar files, starting with JDK 9, we also have JRTs (the JDK modules).- Returns:
- true, iff this location represents an archive, like a JAR or JRT
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
of
@PublicAPI(usage=ACCESS) public static Location of(java.net.URL url)
-
of
@PublicAPI(usage=ACCESS) public static Location of(java.net.URI uri)
-
of
@PublicAPI(usage=ACCESS) public static Location of(java.util.jar.JarFile jar)
-
of
@PublicAPI(usage=ACCESS) public static Location of(java.nio.file.Path path)
-
-