Draw on the right, write (Umple) model code on the left. Analyse models and generate code. This tool stores your data in cookies and on a server. I understand. Click to learn about privacy. Download Donate For help: User manual Ask questions Report issue
class Group { // Simple Umple Integer. Note that code generation // in different languages will use the simplest // native type in that language. In Java it will // use int. // The initial value must be supplied through a // constructor argument. // The value can later be accessed through set and // get methods (here setI and getI). Integer i; // const: Declares a constant (static final in Java). const Integer Max = 100; // immutable: A constructor argument is required so // it can be set at construction time; cannot be // changed after that since no set method is // generated. immutable String str; // lazy: A constructor argument is not required. // Numbers are initialized to zero. // Objects (including Strings) are initialized to null, // Booleans are initialized to false. lazy Time t; lazy Boolean b; lazy s; // settable: Set using a constructor argument and // can be changed after that. This is the default, // so the settable keyword can be omitted. settable Date d; // internal: No getter and setter methods created. // Only for private use in internal methods. However // in this case it is initalized using = The code // following = is in the 'base' language, here Java. internal Time t2 = new Time( System.currentTimeMillis()); // unique: Every new object created must have a // unique new value assigned. // You can get the value. You can set it as well, // but it has to be unique. unique u; // autounique: Every new object created will have a // new integer assigned. // You can get the value (an integer) but not set it. autounique x; // The value is initialized as shown in the constructor. // There is no constructor argument generated. String q = "chicken"; // defaulted: Set in the constructor to the default, // and can be reset to the default any time by // calling a reset method (here resetP()). // Can also be set to any other value using setP(). // The default can be queried by calling getDefaultP(). defaulted String p = "robot"; // Similar to the above, except this shows that if // no type is given, then the default type is String. defaulted r = ""; } // @@@skipcppcompile