source: geniuswebcore/geniusweb/issuevalue/Value.py@ 99

Last change on this file since 99 was 96, checked in by Bart Vastenhouw, 2 years ago

Fixed small issues in domaineditor.

File size: 1.0 KB
Line 
1from _decimal import Decimal
2from abc import ABC
3
4from pyson.JsonDeserialize import JsonDeserialize
5from pyson.JsonSubTypes import JsonSubTypes
6from pyson.JsonValue import JsonValue
7
8
9
10@JsonDeserialize("geniusweb.issuevalue.ValueDeserializer.ValueDeserializer")
11@JsonSubTypes(["geniusweb.issuevalue.NumberValue.NumberValue",\
12 "geniusweb.issuevalue.DiscreteValue.DiscreteValue"])
13class Value(ABC):
14 '''
15 A possible value for an Issue. Must be immutable and thread safe. Supported
16 values are {@link NumberValue} and {@link DiscreteValue}. All values are just
17 strings, a custom deserializer is used to determine which type it is.
18
19 Value must be de-serializable all by itself, because it can occur plain in a
20 Bid eg Bid["fte":0.8]
21 '''
22 def __init__(self, value):
23 self._value = value;
24
25 @JsonValue()
26 def getValue(self) -> str:
27 return self._value;
28
29 def __repr__(self):
30 return str(self._value)
31
32 def __eq__(self, other):
33 return isinstance(other, self.__class__) and self._value == other._value
34
35 def __hash__(self):
36 return hash(self._value)
Note: See TracBrowser for help on using the repository browser.