Versioning

From cdd
Jump to: navigation, search

In CDD all state definitions have a version number. If not given, the version number is defaulted to 1:

import net.sf.laja.cdd.annotation.State;
 
@State
public class PersonState {
    public final int ssn;
    public final String name;


...which is equivalent to:

import net.sf.laja.cdd.annotation.State;
 
@State(version = 1)
public class PersonState {
    public final int ssn;
    public final String name;


The attribute version has the default value of 1 in the definition of the annotation @State. The version number is propagated (when generated) to the state types mutable and string, like this:

@State(version = 3)
public class PersonState implements ImmutableState {
    ...
 
    @State(version = 3, type = "mutable")
    public static class PersonMutableState implements MutableState {
        ...
    }
 
    @State(version = 3, type = "string")
    public static class PersonStringState implements StringState {
        ...
    }
}


The idea of versioning state is to facilitate integration between systems!


< Back          Next >