Lines 461-467
Link Here
|
461 |
PropertyBinding[] pb = new PropertyBinding[type.propertyNames.length]; |
461 |
PropertyBinding[] pb = new PropertyBinding[type.propertyNames.length]; |
462 |
for (int i = 0; i < pb.length; i++) { |
462 |
for (int i = 0; i < pb.length; i++) { |
463 |
pb[i] = b.registerProperty( |
463 |
pb[i] = b.registerProperty( |
464 |
type.propertyNames[i], i, obj, type, type.propertyReadOnly[i] |
464 |
type.propertyNames[i], i, obj, type, |
|
|
465 |
type.propertyReadOnly[i], |
466 |
type.propertyTypes[i] |
465 |
); |
467 |
); |
466 |
} |
468 |
} |
467 |
FunctionBinding[] fb = new FunctionBinding[type.functions.length]; |
469 |
FunctionBinding[] fb = new FunctionBinding[type.functions.length]; |
Lines 500-505
Link Here
|
500 |
public static abstract class Type<Model> { |
502 |
public static abstract class Type<Model> { |
501 |
private final Class<Model> clazz; |
503 |
private final Class<Model> clazz; |
502 |
private final String[] propertyNames; |
504 |
private final String[] propertyNames; |
|
|
505 |
private final Class[] propertyTypes; |
503 |
private final boolean[] propertyReadOnly; |
506 |
private final boolean[] propertyReadOnly; |
504 |
private final String[] functions; |
507 |
private final String[] functions; |
505 |
|
508 |
|
Lines 522-527
Link Here
|
522 |
} |
525 |
} |
523 |
this.clazz = clazz; |
526 |
this.clazz = clazz; |
524 |
this.propertyNames = new String[properties]; |
527 |
this.propertyNames = new String[properties]; |
|
|
528 |
this.propertyTypes = new Class[properties]; |
525 |
this.propertyReadOnly = new boolean[properties]; |
529 |
this.propertyReadOnly = new boolean[properties]; |
526 |
this.functions = new String[functions]; |
530 |
this.functions = new String[functions]; |
527 |
JSON.register(clazz, this); |
531 |
JSON.register(clazz, this); |
Lines 535-542
Link Here
|
535 |
* @param readOnly is the property read only? |
539 |
* @param readOnly is the property read only? |
536 |
*/ |
540 |
*/ |
537 |
protected final void registerProperty(String name, int index, boolean readOnly) { |
541 |
protected final void registerProperty(String name, int index, boolean readOnly) { |
|
|
542 |
registerProperty(name, Object.class, index, readOnly); |
543 |
} |
544 |
|
545 |
/** Registers property for the type. It is expected each index |
546 |
* is initialized only once. |
547 |
* |
548 |
* @param name name of the property |
549 |
* @param type class type of the property |
550 |
* @param index index of the property |
551 |
* @param readOnly is the property read only? |
552 |
* @since 1.1 |
553 |
*/ |
554 |
protected final void registerProperty( |
555 |
String name, Class<?> type, int index, boolean readOnly |
556 |
) { |
538 |
assert propertyNames[index] == null; |
557 |
assert propertyNames[index] == null; |
539 |
propertyNames[index] = name; |
558 |
propertyNames[index] = name; |
|
|
559 |
propertyTypes[index] = type; |
540 |
propertyReadOnly[index] = readOnly; |
560 |
propertyReadOnly[index] = readOnly; |
541 |
} |
561 |
} |
542 |
|
562 |
|