mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-22 14:17:30 +08:00
Type initialization using objects
This commit is contained in:
64
cypress/fixtures/ComplexEntity.js
Normal file
64
cypress/fixtures/ComplexEntity.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import IEntity from "../../js/entity/IEntity"
|
||||
import UnionType from "../../js/entity/UnionType"
|
||||
import SimpleObject from "./SimpleObject"
|
||||
|
||||
export default class ComplexEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
alpha: 32,
|
||||
bravo: {
|
||||
type: Number,
|
||||
value: 78,
|
||||
},
|
||||
charlie: {
|
||||
type: String,
|
||||
value: "Charlie",
|
||||
},
|
||||
delta: {
|
||||
type: String,
|
||||
value: null,
|
||||
},
|
||||
echo: "echo",
|
||||
foxtrot: {
|
||||
value: false,
|
||||
},
|
||||
golf: {
|
||||
type: Array,
|
||||
},
|
||||
hotel: {
|
||||
type: Array,
|
||||
value: null,
|
||||
},
|
||||
india: {
|
||||
type: [Number]
|
||||
},
|
||||
juliett: {
|
||||
type: [String],
|
||||
value: ["a", "b", "c", "d", "e"],
|
||||
},
|
||||
kilo: {
|
||||
type: [Boolean],
|
||||
value: () => [true, false, false, true, true],
|
||||
},
|
||||
lima: {
|
||||
type: String,
|
||||
value: "Foo",
|
||||
showDefault: false,
|
||||
},
|
||||
mike: {
|
||||
type: new UnionType(Number, String, Array),
|
||||
value: "Bar",
|
||||
},
|
||||
november: {
|
||||
type: new UnionType(Number, String, Array),
|
||||
},
|
||||
oscar: {
|
||||
type: SimpleObject
|
||||
},
|
||||
papa: () => new SimpleObject(12, 13),
|
||||
}
|
||||
|
||||
static {
|
||||
this.cleanupAttributes(this.attributes)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user