}
public CharSequence generateReflectiveAccessClassBody(final FXBeanUnit u) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("public class ");
Bean _bean = u.getBean();
String _name = _bean.getName();
_builder.append(_name, "");
_builder.append("Access {");
_builder.newLineIfNotEmpty();
{
Bean _bean_1 = u.getBean();
EList<BeanPropertyDecl> _properties = _bean_1.getProperties();
for(final BeanPropertyDecl p : _properties) {
{
TypeDef _type = p.getType();
if ((_type instanceof ValueListTypeDef)) {
{
ValueListTypeDef _valDef = this.valDef(p);
Multiplicity _multi = _valDef.getMulti();
boolean _notEquals = (!Objects.equal(_multi, null));
if (_notEquals) {
_builder.append("\t");
_builder.append("public static final EFXListProperty<");
Bean _bean_2 = u.getBean();
String _name_1 = _bean_2.getName();
_builder.append(_name_1, " ");
_builder.append(",ObservableList<");
ValueListTypeDef _valDef_1 = this.valDef(p);
JvmTypeReference _singleType = _valDef_1.getSingleType();
String _shortName = this.shortName(_singleType);
_builder.append(_shortName, " ");
_builder.append(">,");
ValueListTypeDef _valDef_2 = this.valDef(p);
JvmTypeReference _singleType_1 = _valDef_2.getSingleType();
String _shortName_1 = this.shortName(_singleType_1);
_builder.append(_shortName_1, " ");
_builder.append("> ");
String _name_2 = p.getName();
String _upperCase = _name_2.toUpperCase();
_builder.append(_upperCase, " ");
_builder.append(" = new EFXListProperty<");
Bean _bean_3 = u.getBean();
String _name_3 = _bean_3.getName();
_builder.append(_name_3, " ");
_builder.append(",ObservableList<");
ValueListTypeDef _valDef_3 = this.valDef(p);
JvmTypeReference _singleType_2 = _valDef_3.getSingleType();
String _shortName_2 = this.shortName(_singleType_2);
_builder.append(_shortName_2, " ");
_builder.append(">,");
ValueListTypeDef _valDef_4 = this.valDef(p);
JvmTypeReference _singleType_3 = _valDef_4.getSingleType();
String _shortName_3 = this.shortName(_singleType_3);
_builder.append(_shortName_3, " ");
_builder.append(">(\"");
String _name_4 = p.getName();
_builder.append(_name_4, " ");
_builder.append("\",ObservableList.class,");
ValueListTypeDef _valDef_5 = this.valDef(p);
JvmTypeReference _singleType_4 = _valDef_5.getSingleType();
String _shortName_4 = this.shortName(_singleType_4);
_builder.append(_shortName_4, " ");
_builder.append(".class,");
boolean _isReadonly = p.isReadonly();
_builder.append(_isReadonly, " ");
_builder.append(",");
boolean _isLazy = p.isLazy();
_builder.append(_isLazy, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t");
_builder.append("public static final EFXProperty<");
Bean _bean_4 = u.getBean();
String _name_5 = _bean_4.getName();
_builder.append(_name_5, " ");
_builder.append(",");
ValueListTypeDef _valDef_6 = this.valDef(p);
JvmTypeReference _singleType_5 = _valDef_6.getSingleType();
String _objectShortType = this.objectShortType(_singleType_5);
_builder.append(_objectShortType, " ");
_builder.append("> ");
String _name_6 = p.getName();
String _upperCase_1 = _name_6.toUpperCase();
_builder.append(_upperCase_1, " ");
_builder.append(" = new EFXProperty<");
Bean _bean_5 = u.getBean();
String _name_7 = _bean_5.getName();
_builder.append(_name_7, " ");
_builder.append(",");
ValueListTypeDef _valDef_7 = this.valDef(p);
JvmTypeReference _singleType_6 = _valDef_7.getSingleType();
String _objectShortType_1 = this.objectShortType(_singleType_6);
_builder.append(_objectShortType_1, " ");
_builder.append(">(\"");
String _name_8 = p.getName();
_builder.append(_name_8, " ");
_builder.append("\",");
ValueListTypeDef _valDef_8 = this.valDef(p);
JvmTypeReference _singleType_7 = _valDef_8.getSingleType();
String _shortName_5 = this.shortName(_singleType_7);
_builder.append(_shortName_5, " ");
_builder.append(".class,");
boolean _isReadonly_1 = p.isReadonly();
_builder.append(_isReadonly_1, " ");
_builder.append(",");
boolean _isLazy_1 = p.isLazy();
_builder.append(_isLazy_1, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
}
}
} else {
_builder.append("\t");
_builder.append("public static final EFXMapProperty<?,?,");
MapTypeDef _mapDef = this.mapDef(p);
JvmTypeReference _keyType = _mapDef.getKeyType();
String _shortName_6 = this.shortName(_keyType);
_builder.append(_shortName_6, " ");
_builder.append(",");
MapTypeDef _mapDef_1 = this.mapDef(p);
JvmTypeReference _valueType = _mapDef_1.getValueType();
String _shortName_7 = this.shortName(_valueType);
_builder.append(_shortName_7, " ");
_builder.append("> ");
String _name_9 = p.getName();
String _upperCase_2 = _name_9.toUpperCase();
_builder.append(_upperCase_2, " ");
_builder.append(" = new EFXMapProperty<?,?,");
MapTypeDef _mapDef_2 = this.mapDef(p);
JvmTypeReference _keyType_1 = _mapDef_2.getKeyType();
String _shortName_8 = this.shortName(_keyType_1);
_builder.append(_shortName_8, " ");
_builder.append(",");
MapTypeDef _mapDef_3 = this.mapDef(p);
JvmTypeReference _valueType_1 = _mapDef_3.getValueType();
String _shortName_9 = this.shortName(_valueType_1);
_builder.append(_shortName_9, " ");
_builder.append(">(\"");
String _name_10 = p.getName();
_builder.append(_name_10, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
}
}
}
}
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("public static final EFXBeanClass<");
Bean _bean_6 = u.getBean();
String _name_11 = _bean_6.getName();
_builder.append(_name_11, " ");
_builder.append("> CLAZZ;");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("static {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("List<EFXFeature<");
Bean _bean_7 = u.getBean();
String _name_12 = _bean_7.getName();
_builder.append(_name_12, " ");
_builder.append(",?>> features = new ArrayList<EFXFeature<");
Bean _bean_8 = u.getBean();
String _name_13 = _bean_8.getName();
_builder.append(_name_13, " ");
_builder.append(",?>>();");
_builder.newLineIfNotEmpty();
{
Bean _bean_9 = u.getBean();
EList<BeanPropertyDecl> _properties_1 = _bean_9.getProperties();
for(final BeanPropertyDecl p_1 : _properties_1) {
_builder.append("\t\t");
_builder.append("features.add(");
String _name_14 = p_1.getName();
String _upperCase_3 = _name_14.toUpperCase();
_builder.append(_upperCase_3, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
}
}
_builder.append("\t\t");
_builder.append("CLAZZ = new EFXBeanClass<");
Bean _bean_10 = u.getBean();
String _name_15 = _bean_10.getName();
_builder.append(_name_15, " ");
_builder.append(">(features);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("public static void set(");
Bean _bean_11 = u.getBean();
String _name_16 = _bean_11.getName();
_builder.append(_name_16, " ");
_builder.append(" bean, EFXProperty<");
Bean _bean_12 = u.getBean();
String _name_17 = _bean_12.getName();
_builder.append(_name_17, " ");
_builder.append(",?> feature, Object value) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("switch( feature.name ) {");
_builder.newLine();
{
Bean _bean_13 = u.getBean();
EList<BeanPropertyDecl> _properties_2 = _bean_13.getProperties();
final Function1<BeanPropertyDecl,Boolean> _function = new Function1<BeanPropertyDecl,Boolean>() {
public Boolean apply(final BeanPropertyDecl p) {
boolean _isReadonly = p.isReadonly();
boolean _not = (!_isReadonly);
return Boolean.valueOf(_not);
}
};
Iterable<BeanPropertyDecl> _filter = IterableExtensions.<BeanPropertyDecl>filter(_properties_2, _function);
for(final BeanPropertyDecl p_2 : _filter) {
{
TypeDef _type_1 = p_2.getType();
if ((_type_1 instanceof ValueListTypeDef)) {
{
TypeDef _type_2 = p_2.getType();
JvmTypeReference _singleType_8 = ((ValueListTypeDef) _type_2).getSingleType();
boolean _isPrimitiveType = this.isPrimitiveType(_singleType_8);
if (_isPrimitiveType) {
{
TypeDef _type_3 = p_2.getType();
JvmTypeReference _singleType_9 = ((ValueListTypeDef) _type_3).getSingleType();
String _qualifiedName = _singleType_9.getQualifiedName();
boolean _equals = _qualifiedName.equals("int");
if (_equals) {
_builder.append("\t\t\t");
_builder.append("case \"");
String _name_18 = p_2.getName();
_builder.append(_name_18, " ");
_builder.append("\" : bean.set");
String _name_19 = p_2.getName();
String _firstUpper = StringExtensions.toFirstUpper(_name_19);
_builder.append(_firstUpper, " ");
_builder.append("(((Number)value).intValue()); return;");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t\t\t");
_builder.append("case \"");
String _name_20 = p_2.getName();
_builder.append(_name_20, " ");
_builder.append("\" : bean.set");
String _name_21 = p_2.getName();
String _firstUpper_1 = StringExtensions.toFirstUpper(_name_21);
_builder.append(_firstUpper_1, " ");
_builder.append("(((Number)value).doubleValue()); return;");
_builder.newLineIfNotEmpty();
}
}
} else {
_builder.append("\t\t\t");
_builder.append("case \"");
String _name_22 = p_2.getName();
_builder.append(_name_22, " ");
_builder.append("\" : bean.set");
String _name_23 = p_2.getName();
String _firstUpper_2 = StringExtensions.toFirstUpper(_name_23);
_builder.append(_firstUpper_2, " ");
_builder.append("((");
TypeDef _type_4 = p_2.getType();
JvmTypeReference _singleType_10 = ((ValueListTypeDef) _type_4).getSingleType();
String _shortName_10 = this.shortName(_singleType_10);
_builder.append(_shortName_10, " ");
_builder.append(")value); return;");
_builder.newLineIfNotEmpty();
}
}
}
}
}
}
_builder.append("\t\t\t");
_builder.append("default: throw new IllegalArgumentException(\"Unknown feature \'\"+feature.name+\"\'\");");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("public static <R> R get(");
Bean _bean_14 = u.getBean();
String _name_24 = _bean_14.getName();
_builder.append(_name_24, " ");
_builder.append(" bean, EFXProperty<");
Bean _bean_15 = u.getBean();
String _name_25 = _bean_15.getName();
_builder.append(_name_25, " ");
_builder.append(",?> feature) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("switch( feature.name ) {");
_builder.newLine();
{
Bean _bean_16 = u.getBean();
EList<BeanPropertyDecl> _properties_3 = _bean_16.getProperties();
final Function1<BeanPropertyDecl,Boolean> _function_1 = new Function1<BeanPropertyDecl,Boolean>() {
public Boolean apply(final BeanPropertyDecl p) {
boolean _isReadonly = p.isReadonly();
boolean _not = (!_isReadonly);
return Boolean.valueOf(_not);