Skip to content

AIDC Toolkit / GS1 / AbstractNumericIdentifierCreator

Abstract Class: AbstractNumericIdentifierCreator

Defined in: src/numeric-identifier-creator.ts:57

Abstract numeric identifier creator. Implements common functionality for a numeric identifier creator.

Extends

Implements

Constructors

Constructor

new AbstractNumericIdentifierCreator(): AbstractNumericIdentifierCreator

Returns

AbstractNumericIdentifierCreator

Inherited from

AbstractIdentifierCreator.constructor

Accessors

leaderType

Get Signature

get abstract leaderType(): string

Defined in: src/numeric-identifier-creator.ts:84

Get the leader type.

Returns

string

Implementation of

NumericIdentifierCreator.leaderType


capacity

Get Signature

get capacity(): number

Defined in: src/numeric-identifier-creator.ts:89

Get the capacity (10**referenceLength).

Returns

number

Implementation of

NumericIdentifierCreator.capacity


tweak

Get Signature

get tweak(): bigint

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

Get the tweak for sparse creation.

Returns

bigint

Set Signature

set tweak(value): void

Defined in: src/numeric-identifier-creator.ts:103

Set the tweak for sparse creation.

Parameters
value

bigint

Returns

void


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

NumericIdentifierCreator.identifierType

Inherited from

AbstractIdentifierCreator.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

NumericIdentifierCreator.prefixType

Inherited from

AbstractIdentifierCreator.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

NumericIdentifierCreator.length

Inherited from

AbstractIdentifierCreator.length


referenceCharacterSet

Get Signature

get abstract referenceCharacterSet(): ContentCharacterSet

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

Get the reference character set.

Returns

ContentCharacterSet

Implementation of

NumericIdentifierCreator.referenceCharacterSet

Inherited from

AbstractIdentifierCreator.referenceCharacterSet


referenceCreator

Get Signature

get abstract referenceCreator(): CharacterSetCreator

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

Get the reference creator.

Returns

CharacterSetCreator

Implementation of

NumericIdentifierCreator.referenceCreator

Inherited from

AbstractIdentifierCreator.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

NumericIdentifierCreator.prefixProvider

Inherited from

AbstractIdentifierCreator.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

NumericIdentifierCreator.prefix

Inherited from

AbstractIdentifierCreator.prefix


referenceLength

Get Signature

get referenceLength(): number

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

Get the reference length.

Returns

number

Implementation of

NumericIdentifierCreator.referenceLength

Inherited from

AbstractIdentifierCreator.referenceLength

Methods

init()

protected init(prefixProvider, prefix): void

Defined in: src/numeric-identifier-creator.ts:77

Initialize the prefix provider. 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.

Returns

void

Overrides

AbstractIdentifierCreator.init


create()

create<TTransformerInput>(valueOrValues, sparse): TransformerOutput<TTransformerInput, string>

Defined in: src/numeric-identifier-creator.ts:125

Type Parameters

TTransformerInput

TTransformerInput extends TransformerInput<number | bigint>

Transformer input type.

Parameters

valueOrValues

TTransformerInput

Numeric value(s).

sparse

boolean = false

If true, the value(s) are mapped to a sparse sequence resistant to discovery. Default is false.

Returns

TransformerOutput<TTransformerInput, string>

Identifier(s).

Implementation of

NumericIdentifierCreator.create


createAll()

createAll(): Iterable<string>

Defined in: src/numeric-identifier-creator.ts:184

Returns

Iterable<string>

All identifiers for the prefix.

Implementation of

NumericIdentifierCreator.createAll


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

NumericIdentifierCreator.validate

Inherited from

AbstractIdentifierCreator.validate