Returns a normalized form of the passed object.
Returns a normalized form of the passed object.
If the passed object is already in normal form, this method may return the same instance passed.
the object to normalize
the normalized form of the passed object
Returns a new Uniformity
that combines this and the passed Uniformity
.
Returns a new Uniformity
that combines this and the passed Uniformity
.
The normalized
and normalizedOrSame
methods
of the Uniformity
returned by this method return a result
obtained by forwarding the passed value first to this Uniformity
's implementation of the method,
then passing that result to the other Uniformity
's implementation of the method, respectively.
Essentially, the body of the composed normalized
method is:
uniformityPassedToAnd.normalized(uniformityOnWhichAndWasInvoked.normalized(a))
And the body of the composed normalizedOrSame
method is:
uniformityPassedToAnd.normalizedOrSame(uniformityOnWhichAndWasInvoked.normalizedOrSame(a))
The normalizeCanHandle
method of the Uniformity
returned by this method returns a result
obtained by anding the result of forwarding the passed value to this Uniformity
's implementation of the method
with the result of forwarding it to the passed Uniformity
's implementation.
Essentially, the body of the composed normalizeCanHandle
method is:
uniformityOnWhichAndWasInvoked.normalizeCanHandle(a) && uniformityPassedToAnd.normalizeCanHandle(a)
a Uniformity
to 'and' with this one
a Uniformity
representing the composition of this and the passed Uniformity
Returns a new Normalization
that composes this and the passed Normalization
.
Returns a new Normalization
that composes this and the passed Normalization
.
The normalized
method of the Normalization
returned by this method returns a normalized form of the passed
object obtained by forwarding the passed value first to this Normalization
's normalized
method,
then passing that result to the other Normalization
's normalized
method.
Essentially, the body of the composed normalized
method is:
normalizationPassedToAnd.normalized(normalizationOnWhichAndWasInvoked.normalized(a))
a Normalization
to 'and' with this one
a Normalization
representing the composition of this and the passed Normalization
Returns true if the passed Any
is a String
.
Returns true if the passed Any
is a String
.
true if the passed Any
is a String
.
Normalizes the passed object if it is a String
.
Normalizes the passed object if it is a String
.
This method returns either:
String
, the result of passing that string to normalized
the object to normalize, if appropriate
a normalized form of any passed String
, or the same object if not a String
.
Converts this Uniformity
to a NormalizingEquality[A]
whose normalized
,
normalizedCanHandle
, and normalizedOrSame
methods delegate
to this Uniformity[A]
and whose afterNormalizationEquality
field returns the
implicitly passed Equality[A]
.
Converts this Uniformity
to a NormalizingEquality[A]
whose normalized
,
normalizedCanHandle
, and normalizedOrSame
methods delegate
to this Uniformity[A]
and whose afterNormalizationEquality
field returns the
implicitly passed Equality[A]
.
the Equality
that the returned NormalizingEquality
will delegate to determine equality after normalizing both left and right (if appropriate) sides.
Converts this Normalization
to a NormalizingEquivalence[A]
whose normalized
method delegates to this Normalization[A]
and whose afterNormalizationEquivalence
field returns the
implicitly passed Equivalence[A]
.
Converts this Normalization
to a NormalizingEquivalence[A]
whose normalized
method delegates to this Normalization[A]
and whose afterNormalizationEquivalence
field returns the
implicitly passed Equivalence[A]
.
the Equivalence
that the returned NormalizingEquivalence
will delegate to determine equality after normalizing both left and right (if appropriate) sides.
Convenience base trait for string
Uniformity
s.This trait defines a
normalizedCanHandle
method that returns true if the passedAny
is aString
and anormalizedOrSame
method that normalizes any passedString
s via thenormalized
method, which is left abstract for subclasses to fill in.Here's an example in which
AbstractStringUniformity
is used to normalize strings by ensuring the first character, if any, is capitalized:Here's an example of using the
capitalized
Uniformity
with aMatcher
expression: