public final class IdentifierValidator extends Object
toString
method. Two equal identifiers must always produce the same toString
values,
even between JVM restarts. Typically, this also means equals
and hashCode
need to be
implemented.
For optimization purposes, this validator keeps a white-list of all aggregate types that have passed validation. This reduces the amount of reflection for types that have been already inspected.
Modifier and Type | Method and Description |
---|---|
static IdentifierValidator |
getInstance()
Returns the singleton instance of the IdentifierValidator.
|
boolean |
isValidIdentifier(Class<?> identifierType)
Indicates whether or not the given
identifierType is safe to use as aggregate identifier |
static void |
validateIdentifier(Class<?> aggregateIdentifierType)
Verifies whether the given
aggregateIdentifier complies with the toString requirements
and throws IllegalArgumentException if that is not the case. |
public static IdentifierValidator getInstance()
public static void validateIdentifier(Class<?> aggregateIdentifierType)
aggregateIdentifier
complies with the toString
requirements
and throws IllegalArgumentException if that is not the case.
If a mere boolean is required, consider using getInstance().
.isValidIdentifier(Class)
aggregateIdentifierType
- The identifier to validatepublic boolean isValidIdentifier(Class<?> identifierType)
identifierType
is safe to use as aggregate identifieridentifierType
- The class of the identifiertrue
if the identifier is valid, false
otherwiseCopyright © 2010-2014. All Rights Reserved.