// Meta - a "minimal" approach to adding meta-level to Java objects sclass Meta implements IMeta { // We allocate one extra field for each Java object to make it // reasoning-compatible. We couldn't go for 0 extra fields and // there are no half fields in Java... so there you go. // Also, if you don't use any meta data, you are probably not // reasoning about anything. The point of reasoning in JavaX is // to attach information to objects directly used in the program. // Possible information contained in the meta field: // Origin, destination, security level, sender, cost center, // purpose, list of reifications, ... // So here it is. THE FIELD YOU HAVE BEEN WAITING FOR // We also have IMeta to retrofit foreign classes (rare but // probably useful) //////////// // "meta" // //////////// // Generic meta value of any kind, but the typical case is it's a // Map with extra field values for the object etc. // "meta" is volatile to avoid synchronization; but you can also synchronize on // _tempMetaMutex() which is usually the object itself. Still considering // whether that is actually a good idea. volatile O meta; // ...and the interface methods public void _setMeta(O meta) { this.meta = meta; } public O _getMeta() { ret meta; } // That was layer 1... // ...and here is the convenience stuff - just use the meta field like a regular map. void metaSet aka metaPut(O key, O value) { metaMapPut(this, key, value); } O metaGet(O key) { ret metaMapGet(this, key); } }