Skip to content

AIDC Toolkit / GS1 / AbstractIdentifierCreator

Abstract Class: AbstractIdentifierCreator

Defined in: src/identifier-creator.ts:35

Abstract identifier creator. Implements common functionality for an identifier creator, bound to a PrefixProvider.

Extended by

Implements

Constructors

Constructor

new AbstractIdentifierCreator(): AbstractIdentifierCreator

Returns

AbstractIdentifierCreator

Accessors

identifierType

Get Signature

get abstract identifierType(): IdentifierType

Defined in: src/identifier-creator.ts:65

Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining properties.

Returns

IdentifierType

Implementation of

IdentifierCreator.identifierType


prefixType

Get Signature

get abstract prefixType(): PrefixType

Defined in: src/identifier-creator.ts:67

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

PrefixType

Implementation of

IdentifierCreator.prefixType


length

Get Signature

get abstract length(): number

Defined in: src/identifier-creator.ts:69

Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length is the maximum.

Returns

number

Implementation of

IdentifierCreator.length


referenceCharacterSet

Get Signature

get abstract referenceCharacterSet(): ContentCharacterSet

Defined in: src/identifier-creator.ts:71

Get the reference character set.

Returns

ContentCharacterSet

Implementation of

IdentifierCreator.referenceCharacterSet


referenceCreator

Get Signature

get abstract referenceCreator(): CharacterSetCreator

Defined in: src/identifier-creator.ts:73

Get the reference creator.

Returns

CharacterSetCreator

Implementation of

IdentifierCreator.referenceCreator


prefixProvider

Get Signature

get prefixProvider(): PrefixProvider

Defined in: src/identifier-creator.ts:78

Get the prefix provider to which this identifier creator is bound.

Returns

PrefixProvider

Implementation of

IdentifierCreator.prefixProvider


prefix

Get Signature

get prefix(): string

Defined in: src/identifier-creator.ts:85

Get the prefix, equivalent to calling PrefixProvider.prefix | prefixProvider.prefix for a GTIN or PrefixProvider.gs1CompanyPrefix | prefixProvider.gs1CompanyPrefix for all other identifier types.

Returns

string

Implementation of

IdentifierCreator.prefix


referenceLength

Get Signature

get referenceLength(): number

Defined in: src/identifier-creator.ts:92

Get the reference length.

Returns

number

Implementation of

IdentifierCreator.referenceLength

Methods

init()

protected init(prefixProvider, prefix, checkAllowance): void

Defined in: src/identifier-creator.ts:58

Initialize the prefix manager. This method is in lieu of a constructor due to the mixin architecture.

Parameters

prefixProvider

PrefixProvider

Prefix provider.

prefix

string

Prefix within prefix manager to use to calculate reference length.

checkAllowance

number

Number of characters to allow for check digit or check character pair.

Returns

void


validate()

abstract validate(identifier, validation?): void

Defined in: src/identifier-creator.ts:96

Validate an identifier and throw an error if validation fails.

Parameters

identifier

string

Identifier.

validation?

IdentifierValidation

Identifier validation parameters.

Returns

void

Implementation of

IdentifierCreator.validate