T
- The obfuscated value type.public abstract class Obfuscated<T> extends Object
toString()
is called, and can be used to prevent
leaking the obfuscated value's string presentation by accident, e.g. by logging it.Modifier and Type | Method and Description |
---|---|
abstract Obfuscated<T> |
cached()
Returns an obfuscated object that caches the results of obfuscating.
|
boolean |
equals(Object o) |
int |
hashCode() |
<U> Obfuscated<U> |
map(Function<? super T,? extends U> mapper)
Applies a mapping function to the obfuscated value.
|
<U> Obfuscated<U> |
map(Function<? super T,? extends U> mapper,
Supplier<? extends CharSequence> representation)
Applies a mapping function to the obfuscated value.
|
abstract <U> Obfuscated<U> |
mapWithSameRepresentation(Function<? super T,? extends U> mapper)
Applies a mapping function to the obfuscating value.
|
abstract String |
toString() |
T |
value()
Returns the obfuscated value.
|
public final T value()
public final <U> Obfuscated<U> map(Function<? super T,? extends U> mapper)
Obfuscator.obfuscateObject(Object)
on the obfuscator that created this object, passing the result of
applying the given mapping function to the obfuscated value.U
- The result type of the mapping function.mapper
- The mapping function to apply.Obfuscated
object wrapping the result of applying the given mapping function to this object's value.NullPointerException
- If the mapping function is null
,
or if the mapping function returns a null
value when applied to this object's value.public final <U> Obfuscated<U> map(Function<? super T,? extends U> mapper, Supplier<? extends CharSequence> representation)
Obfuscator.obfuscateObject(Object, Supplier)
on the obfuscator that created this object, passing the
result of applying the given mapping function to the obfuscated value.U
- The result type of the mapping function.mapper
- The mapping function to apply.representation
- A supplier for the character representation that will be used to obfuscate the value.
This can be used for values that don't have a sensible string representation
of their own.Obfuscated
object wrapping the result of applying the given mapping function to this object's value.NullPointerException
- If the mapping function or supplier is null
,
or if the mapping function returns a null
value when applied to this object's value.public abstract <U> Obfuscated<U> mapWithSameRepresentation(Function<? super T,? extends U> mapper)
map(Function)
and map(Function, Supplier)
, the result will use the same representation to obfuscate as this object.
If this object caches
the results of obfuscating, so will the result.U
- The result type of the mapping function.mapper
- The mapping function to apply.Obfuscated
object wrapping the result of applying the given mapping function to this object's value.NullPointerException
- If the mapping function is null
,
or if the mapping function returns a null
value when applied to this object's value.public abstract Obfuscated<T> cached()
Copyright © 2020–2023. All rights reserved.