@@ -2552,25 +2552,43 @@ boolean variable(Context context, DeclarationList declList) throws ParserExcepti
25522552 if (context .namespace != null && context .javaName == null ) {
25532553 decl .text += "@Namespace(\" " + context .namespace + "\" ) " ;
25542554 }
2555- if (metadcl != null && metadcl .cppName != null && metadcl .cppName .length () > 0 ) {
2556- decl .text += metadcl .indices == 0
2555+ final boolean hasMetadcl = metadcl != null && metadcl .cppName != null && metadcl .cppName .length () > 0 ;
2556+ String nameAnnotation = "" ;
2557+ if (hasMetadcl ) {
2558+ nameAnnotation = metadcl .indices == 0
25572559 ? "@Name(\" " + metadcl .cppName + "." + shortName + "\" ) "
25582560 : "@Name({\" " + metadcl .cppName + "\" , \" ." + shortName + "\" }) " ;
2559- dcl .type .annotations = dcl .type .annotations .replaceAll ("@Name\\ (.*\\ ) " , "" );
25602561 javaName = metadcl .javaName + "_" + shortName ;
25612562 }
2563+ final boolean addMemberPrefixes = context .addMemberPrefixes && indices .isEmpty ();
2564+ String capitalizedJavaName = null ;
2565+ if (addMemberPrefixes ) {
2566+ if (!hasMetadcl ) {
2567+ nameAnnotation = "@Name(\" " + shortName + "\" ) " ;
2568+ }
2569+ capitalizedJavaName = javaName .substring (0 , 1 ).toUpperCase () + javaName .substring (1 );
2570+ javaName = "get" + capitalizedJavaName ;
2571+ }
2572+ if (hasMetadcl || addMemberPrefixes ) {
2573+ dcl .type .annotations = dcl .type .annotations .replaceAll ("@Name\\ (.*\\ ) " , "" );
2574+ decl .text += nameAnnotation ;
2575+ }
2576+ dcl .type .annotations = dcl .type .annotations .replace ("@ByVal " , "@ByRef " );
25622577 final boolean hasSetter = !(dcl .type .constValue && dcl .indirections == 0 ) && !dcl .constPointer && !dcl .type .constExpr && !context .immutable ;
2563- if (!hasSetter ) {
2578+ if (!hasSetter || addMemberPrefixes ) {
25642579 decl .text += "@MemberGetter " ;
25652580 }
2566- decl .text += modifiers + dcl .type .annotations .replace ("@ByVal " , "@ByRef " )
2567- + dcl .type .javaName + " " + javaName + "(" + indices + ");" ;
2581+ decl .text += modifiers + dcl .type .annotations + dcl .type .javaName + " " + javaName + "(" + indices + ");" ;
25682582 if (hasSetter ) {
25692583 if (indices .length () > 0 ) {
25702584 indices += ", " ;
25712585 }
2572- String javaTypeWithoutAnnotations = dcl .type .javaName .substring (dcl .type .javaName .lastIndexOf (" " ) + 1 );
2573- decl .text += " " + modifiers + setterType + javaName + "(" + indices + javaTypeWithoutAnnotations + " setter);" ;
2586+ if (addMemberPrefixes ) {
2587+ decl .text += "\n " + nameAnnotation + "@MemberSetter " + modifiers + setterType + "set" + capitalizedJavaName + "(" + indices + dcl .type .annotations + dcl .type .javaName + " setter);" ;
2588+ } else {
2589+ String javaTypeWithoutAnnotations = dcl .type .javaName .substring (dcl .type .javaName .lastIndexOf (" " ) + 1 );
2590+ decl .text += " " + nameAnnotation + modifiers + setterType + javaName + "(" + indices + javaTypeWithoutAnnotations + " setter);" ;
2591+ }
25742592 }
25752593 decl .text += "\n " ;
25762594 if ((dcl .type .constValue || dcl .constPointer || dcl .type .constExpr ) && dcl .type .staticMember && indices .length () == 0 ) {
@@ -3292,6 +3310,8 @@ boolean group(Context context, DeclarationList declList) throws ParserException
32923310 ctx .virtualize = true ;
32933311 if (info .immutable )
32943312 ctx .immutable = true ;
3313+ if (info .addMemberPrefixes )
3314+ ctx .addMemberPrefixes = true ;
32953315 }
32963316 ctx .baseType = base .cppName ;
32973317
0 commit comments