Class BulkEntryResult
java.lang.Object
lol.trq.alts.bulk.BulkEntryResult
What became of one entry in a bulk run.
The label is the resolved username, or a positional "entry 12" before one is known.
It is deliberately never the input line: for an import that line is a credential, and results are
exactly what a host renders into a list and writes to a log.
A result is exactly one of a success with an account or a failure without one. A final class rather
than a record since 1.0.0, so a later field is an addition and not a break: the library builds results
with success(int, AltAccount, String, int) and failure, and a host's test can too. Two results are equal when every
field is.
- Since:
- 0.9.0
-
Method Summary
Modifier and TypeMethodDescriptionaccount()Returns the resolved or refreshed account.intattempts()Returns how many times this entry was tried, counting the first.Returns what the account owns, on a successful entry of an entitlement sweep.booleanReturns whetherois a result with every field equal to this one's.failure()Returns why the entry failed; carried since 1.0.0 in place of the former success flag and reason.static BulkEntryResultfailure(int index, String label, AltsFailure failure, int attempts) Creates a failed result, whose message is the failure's.inthashCode()Returns a hash over every field, consistent withequals(Object).intindex()Returns the entry's position in the list it was given, counting from 0.label()Returns a name safe to display and log: the resolved username, or a positional label.message()Returns a short human-readable description; on a failure, the failure's message.static StringpositionalLabel(int index) Returns the label an entry carries before it has resolved a name.booleansuccess()Returns whether the entry succeeded.static BulkEntryResultsuccess(int index, AltAccount account, String message, int attempts) Creates a successful result.static BulkEntryResultsuccess(int index, AltAccount account, Entitlements entitlements, String message, int attempts) Creates a successful entitlement-sweep result.toString()Returns every field, in the form the record printed them; the account describes itself with its credentials redacted.
-
Method Details
-
success
Creates a successful result.- Parameters:
index- the entry's positionaccount- the account it producedmessage- a short descriptionattempts- how many times it was tried- Returns:
- a successful result labelled with the account's username
- Throws:
NullPointerException- ifaccountis null- Since:
- 0.9.0
-
success
public static BulkEntryResult success(int index, AltAccount account, Entitlements entitlements, String message, int attempts) Creates a successful entitlement-sweep result.- Parameters:
index- the entry's positionaccount- the account that was readentitlements- what it ownsmessage- a short descriptionattempts- how many times it was tried- Returns:
- a successful result carrying the entitlements
- Throws:
NullPointerException- ifaccountis null- Since:
- 0.12.0
-
failure
Creates a failed result, whose message is the failure's.- Parameters:
index- the entry's positionlabel- a name safe to display, never the input linefailure- why the entry failedattempts- how many times it was tried- Returns:
- a failed result
- Throws:
NullPointerException- iffailureis null- Since:
- 1.0.0
-
positionalLabel
Returns the label an entry carries before it has resolved a name.- Parameters:
index- the entry's position- Returns:
- a positional label
- Since:
- 0.9.0
-
index
public int index()Returns the entry's position in the list it was given, counting from 0.- Returns:
- the index
- Since:
- 0.9.0
-
label
Returns a name safe to display and log: the resolved username, or a positional label.- Returns:
- the label
- Since:
- 0.9.0
-
account
Returns the resolved or refreshed account.- Returns:
- the account, or
nullwhen the entry failed - Since:
- 0.9.0
-
failure
Returns why the entry failed; carried since 1.0.0 in place of the former success flag and reason.- Returns:
- the failure, or empty when the entry succeeded
- Since:
- 1.0.0
-
message
Returns a short human-readable description; on a failure, the failure's message.- Returns:
- the message
- Since:
- 0.9.0
-
attempts
public int attempts()Returns how many times this entry was tried, counting the first.- Returns:
- the attempt count
- Since:
- 0.9.0
-
entitlements
Returns what the account owns, on a successful entry of an entitlement sweep.- Returns:
- the entitlements, or
nullfor every other kind of run and for a failed entry - Since:
- 0.12.0
-
success
public boolean success()Returns whether the entry succeeded.- Returns:
- true when there is no failure
- Since:
- 0.9.0
-
equals
-
hashCode
public int hashCode()Returns a hash over every field, consistent withequals(Object). -
toString
-