Class ModuleInfoHash
java.lang.Object
com.netflix.module.ModuleInfoHash
Reads, writes, and verifies detached
module-info.hash files.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds immutable detached module hash sets.static final recordA module key in a hash file. -
Method Summary
Modifier and TypeMethodDescriptionbooleancovers(ModuleInfoHash observed) Tests whether all observed entries occur unchanged in this set.differences(ModuleInfoHash observed) Describes entries which are missing, no longer observed, or changed.booleanget(ModuleInfoHash.Coordinate coordinate) Returns the hash recorded for a coordinate.Returns the hash recorded for an unversioned module name.Returns the hash recorded for a module name and descriptor version.inthashCode()Returns the hash recorded for a coordinate.keys()Returns the recorded coordinates.static ModuleInfoHash.BuilderCreates an empty hash-set builder.static ModuleInfoHashReads a detached module hash file.intsize()Returns the number of recorded coordinates.booleanverify(ModuleReference reference) Tests whether a module has the hash recorded for the coordinate reported by its descriptor.booleanverify(String name, String version, ModuleReference reference) Tests whether a module has the hash recorded for its name and version.voidWrites entries in coordinate order.
-
Method Details
-
read
Reads a detached module hash file. Blank lines and lines beginning with#are ignored.- Parameters:
path- the hash file- Returns:
- the hashes in the file
- Throws:
IOException- if the file cannot be read or contains an invalid entry
-
write
Writes entries in coordinate order.- Parameters:
path- the destination file- Throws:
IOException- if the file cannot be written
-
get
Returns the hash recorded for a coordinate.- Parameters:
coordinate- the coordinate to find- Returns:
- the recorded hash, or an empty value
-
get
Returns the hash recorded for an unversioned module name.- Parameters:
name- the module name- Returns:
- the recorded hash, or an empty value
-
get
Returns the hash recorded for a module name and descriptor version.- Parameters:
name- the module nameversion- the module version- Returns:
- the recorded hash, or an empty value
-
verify
Tests whether a module has the hash recorded for the coordinate reported by its descriptor.- Parameters:
reference- the resolved module- Returns:
trueif an entry exists and matches the module content- Throws:
IOException- if the module cannot be read
-
verify
Tests whether a module has the hash recorded for its name and version.- Parameters:
name- the module nameversion- the module versionreference- the resolved module- Returns:
trueif an entry exists and matches the module content- Throws:
IOException- if the module cannot be read
-
keys
Returns the recorded coordinates.- Returns:
- an unmodifiable set of coordinates
-
hashForKey
Returns the hash recorded for a coordinate.- Parameters:
key- the coordinate to find- Returns:
- the recorded hash, or an empty value
-
covers
Tests whether all observed entries occur unchanged in this set.- Parameters:
observed- the entries that must be covered- Returns:
trueif every observed entry is present and equal
-
differences
Describes entries which are missing, no longer observed, or changed.- Parameters:
observed- the resolved entries to compare- Returns:
- immutable descriptions ordered by coordinate
-
size
public int size()Returns the number of recorded coordinates.- Returns:
- the entry count
-
equals
-
hashCode
-
newBuilder
Creates an empty hash-set builder.- Returns:
- a new builder
-