AIDC Toolkit / GS1 / AbstractNumericIdentifierValidator
Abstract Class: AbstractNumericIdentifierValidator
Defined in: src/numeric-identifier-validator.ts:64
Abstract numeric identifier validator. Implements common functionality for a numeric identifier validator.
Extends
Extended by
Implements
Constructors
Constructor
protectednew AbstractNumericIdentifierValidator(identifierType,prefixType,length,leaderType):AbstractNumericIdentifierValidator
Defined in: src/numeric-identifier-validator.ts:90
Constructor.
Parameters
identifierType
Identifier type.
prefixType
Prefix type.
length
number
Length.
leaderType
string
Leader type.
Returns
AbstractNumericIdentifierValidator
Overrides
AbstractIdentifierValidator.constructor
Accessors
leaderType
Get Signature
get leaderType():
string
Defined in: src/numeric-identifier-validator.ts:100
Get the leader type.
Returns
string
Implementation of
NumericIdentifierValidator.leaderType
identifierType
Get Signature
get identifierType():
IdentifierType
Defined in: src/identifier-validator.ts:170
Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining properties.
Returns
Implementation of
NumericIdentifierValidator.identifierType
Inherited from
AbstractIdentifierValidator.identifierType
prefixType
Get Signature
get prefixType():
PrefixType
Defined in: src/identifier-validator.ts:177
Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is PrefixTypes.GS1CompanyPrefix. For the GTIN, the prefix type determines the length.
Returns
Implementation of
NumericIdentifierValidator.prefixType
Inherited from
AbstractIdentifierValidator.prefixType
length
Get Signature
get length():
number
Defined in: src/identifier-validator.ts:184
Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length is the maximum.
Returns
number
Implementation of
NumericIdentifierValidator.length
Inherited from
AbstractIdentifierValidator.length
referenceCharacterSet
Get Signature
get referenceCharacterSet():
ContentCharacterSet
Defined in: src/identifier-validator.ts:191
Get the reference character set.
Returns
Implementation of
NumericIdentifierValidator.referenceCharacterSet
Inherited from
AbstractIdentifierValidator.referenceCharacterSet
referenceCreator
Get Signature
get referenceCreator():
CharacterSetCreator
Defined in: src/identifier-validator.ts:198
Get the reference creator.
Returns
Implementation of
NumericIdentifierValidator.referenceCreator
Inherited from
AbstractIdentifierValidator.referenceCreator
Methods
creatorFor()
protectedstaticcreatorFor(characterSet):CharacterSetCreator
Defined in: src/identifier-validator.ts:140
Get the character set creator for a character set.
Parameters
characterSet
Character set.
Returns
Character set creator.
Inherited from
AbstractIdentifierValidator.creatorFor
validate()
validate(
identifier,validation?):void
Defined in: src/numeric-identifier-validator.ts:107
Validate an identifier and throw an error if validation fails.
Parameters
identifier
string
Identifier.
validation?
Identifier validation parameters.
Returns
void
Implementation of
NumericIdentifierValidator.validate
Overrides
AbstractIdentifierValidator.validate
padIdentifier()
protectedpadIdentifier(identifier,validation):string
Defined in: src/identifier-validator.ts:215
Pad an identifier on the left with zero-value character for validation purposes. This is done to align an identifier with a position offset for any error message that may be thrown by the reference validator.
Parameters
identifier
string
Identifier.
validation
Identifier validation parameters.
IdentifierValidation | undefined
Returns
string
Padded identifier.
Inherited from
AbstractIdentifierValidator.padIdentifier
validatePrefix()
protectedvalidatePrefix(partialIdentifier,positionOffset?):void
Defined in: src/identifier-validator.ts:229
Validate the prefix within an identifier.
Parameters
partialIdentifier
string
Partial identifier.
positionOffset?
number
Position offset within a larger string.
Returns
void