
1 // 2 // Copyright (c) 2006, Brian Frank and Andy Frank 3 // Licensed under the Academic Free License version 3.0 4 // 5 // History: 6 // 6 Jan 06 Brian Frank Creation 7 // 8 9 ** 10 ** Field is a slot which models the ability to get and set a value. 11 ** 12 class Field : Slot 13 { 14 15 ////////////////////////////////////////////////////////////////////////// 16 // Constructor 17 ////////////////////////////////////////////////////////////////////////// 18 19 ** 20 ** Dynamic slot constructor. Dynamic fields must subclass 'Field' 21 ** and override 'get' and 'set' with an implementation for managing 22 ** the state of the field. 23 ** 24 protected new make(Str name, Type of, Str:Obj facets := null) 25 26 ////////////////////////////////////////////////////////////////////////// 27 // Identity 28 ////////////////////////////////////////////////////////////////////////// 29 30 ** 31 ** Type stored by the field. 32 ** 33 Type of() 34 35 ////////////////////////////////////////////////////////////////////////// 36 // Reflection 37 ////////////////////////////////////////////////////////////////////////// 38 39 ** 40 ** Get the field for the specified instance. If the field is 41 ** static, then the instance parameter is ignored. If the getter 42 ** is non-null, then it is used to get the field. 43 ** 44 virtual Obj get(Obj instance := null) 45 46 ** 47 ** Set the field for the specified instance. If the field is 48 ** static, then the instance parameter is ignored. If the setter 49 ** is non-null, then it is used to set the field. 50 ** 51 virtual Void set(Obj instance, Obj value) 52 53 }