# Class Discipline

Discipline

##### Index

### Properties

objectCount
objectsWithGeometryCount
short
All
NotAvailable
NotAvailableShortId

### Accessors

description
referencedClasses

### Methods

clearCache
getOrAdd
getOrAddFromServerRelativeUrl
reset

## Properties

### `Readonly` objectCount

objectCount: number

Number of product instances using this discipline.

### `Readonly` objectsWithGeometryCount

objectsWithGeometryCount: number

Number of product instances where hasGeometry is true that are using this discipline.

### `Readonly` short

short: string

### `Static` `Readonly` All

All: Map<string, string>

Short ID for all known disciplines mapped to their full names

### `Static` `Readonly` NotAvailable

NotAvailable: Discipline

Discipline representing a not unknown discipline.

### `Static` `Readonly` NotAvailableShortId

NotAvailableShortId: string

Short ID for not unknown discipline. Used for unknown disciplines.

## Accessors

### description

- get description(): string

  Discipline description

  #### Returns string

### referencedClasses

- get referencedClasses(): DeepImmutableObject<ModelProductClass>[]

  Gets an array of all classes that have references to this discipline.

  #### Returns DeepImmutableObject<ModelProductClass>[]

## Methods

### `Static` clearCache

- clearCache(): void

  Clears the internal instance cache. After calling this, subsequent calls to getOrAdd will create new instances. Existing references to previously cached instances remain valid but will no longer be returned by getOrAdd.

  Use this in server-side scenarios where multiple models are processed sequentially to prevent unbounded cache growth.

  #### Returns void

### `Static` getOrAdd

- getOrAdd(disciplineShort: string): Discipline

  Gets a Discipline instance from a discipline short code.

  #### Parameters

  - disciplineShort: string

    short discipline code. See Discipline.All for a non exhaustive list.

  #### Returns Discipline

  Discipline representing the short code.

### `Static` getOrAddFromServerRelativeUrl

- getOrAddFromServerRelativeUrl(serverRelativeUrl: string): Discipline

  Get the discipline that a serverRelativeUrl represents. We simply split the url on / and attempt to find the last segment that matches a known discipline short id. If none is found then Discipline.NotAvailable is returned.

  #### Parameters

  - serverRelativeUrl: string

  #### Returns Discipline

  Discipline. If instance is reference equal to Discipline.NotAvailable then no discipline was found.

### `Static` reset

- reset(): void

  Resets all disciplines to their original state. referencedClasses is cleared. objectCount and objectsWithGeometryCount are set to 0

  #### Returns void