-
Notifications
You must be signed in to change notification settings - Fork 1
Bio Enum Composition
Rajab Davudov edited this page Mar 13, 2019
·
1 revision
Bio Enums can be used as tag type. Let's check this example:
@BioEnumObj
public class EngineType extends BioEnum {
public EngineType(int ordinal, String name) {
super(ordinal, name);
}
public final static EngineType VEE = new EngineType(0, "vee");
public final static EngineType INLINE = new EngineType(1, "inline");
public final static EngineType ROTARY = new EngineType(2, "rotary");
}
@BioObj
public class Engine extends BioObject {
@BioTag(type="Integer", initial="3200")
public static final String CAPACITY = "capacity" ;
@BioTag(type="Integer", initial="250")
public static final String HORSE_POWER = "horse_power" ;
@BioTag(type="Integer", initial="6")
public static final String NUMBER_OF_CYLINDERS = "number_of_cylinders" ;
@BioTag(type="EngineType", initial="vee")
public static final String ENGINE_TYPE = "engine_type" ;
}
engine_type here is a tag with Bio Enum type. Moreover, it has an initial value. No matter, enums are numbers in most places you can use their string representation.
You can also have an array or list of enums.
@BioObj
public class Vehicle extends BioObject {
@BioTag(type="EngineType", isArray=true, initial="vee,inline")
public static final String VALID_ENGINE_TYPES = "valid_engine_types" ;
}