-
Notifications
You must be signed in to change notification settings - Fork 0
/
integer_enum_attribute_descriptor.ts
50 lines (46 loc) · 1.36 KB
/
integer_enum_attribute_descriptor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import * as identityEntitiesProto from "../../bridge/proto/identity_entities";
import { AttributeDescriptor } from "./attribute_descriptor";
/**
* Represents a descriptor for an attribute with an integer enum value.
*/
export class IntegerEnumAttributeDescriptor extends AttributeDescriptor {
enumeration: number[];
/**
* Constructs an IntegerEnumAttributeDescriptor object with the specified parameters.
* @param displayName
* @param technicalName
* @param description
* @param required
* @param enumeration
*/
constructor(
displayName: string,
technicalName: string,
description: string,
required: boolean,
enumeration: number[]
) {
super(displayName, technicalName, description, required);
this.enumeration = enumeration;
}
public toProto(): identityEntitiesProto.IntegerEnumAttributeDefinition {
return identityEntitiesProto.IntegerEnumAttributeDefinition.fromPartial({
displayName: this.displayName,
id: this.technicalName,
description: this.description,
required: this.required,
enum: this.enumeration
});
}
static fromProto(
r: identityEntitiesProto.IntegerEnumAttributeDefinition
): IntegerEnumAttributeDescriptor {
return new IntegerEnumAttributeDescriptor(
r.displayName,
r.id,
r.description,
r.required,
r.enum
);
}
}