private TypeSpec getBinderWrapper() {
        TypeSpec.Builder staticBinderWrapperClassBuilder = TypeSpec
                .classBuilder("BinderWrapper")
                .addModifiers(Modifier.PRIVATE)
                .addModifiers(Modifier.STATIC)
                .addField(ClassName.get("android.os", "IBinder"), "binder", Modifier.PRIVATE)
                .addMethod(MethodSpec.constructorBuilder()
                        .addParameter(ClassName.get("android.os", "IBinder"), "binder")
                        .addStatement("this.binder = binder")
                        .build())
                .addMethod(MethodSpec.methodBuilder("asBinder")
                        .addModifiers(Modifier.PUBLIC)
                        .addAnnotation(Override.class)
                        .returns(ClassName.get("android.os", "IBinder"))
                        .addStatement("return binder")
                        .build())
                .addSuperinterface(ClassName.get("android.os", "IInterface"));

        return staticBinderWrapperClassBuilder.build();
    }
private TypeSpec getBinderWrapper ( ) { TypeSpec . Builder staticBinderWrapperClassBuilder = TypeSpec . classBuilder ( "BinderWrapper" ) . addModifiers ( Modifier . PRIVATE ) . addModifiers ( Modifier . STATIC ) . addField ( ClassName . get ( "android.os" , "IBinder" ) , "binder" , Modifier . PRIVATE ) . addMethod ( MethodSpec . constructorBuilder ( ) . addParameter ( ClassName . get ( "android.os" , "IBinder" ) , "binder" ) . addStatement ( "this.binder = binder" ) . build ( ) ) . addMethod ( MethodSpec . methodBuilder ( "asBinder" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( ClassName . get ( "android.os" , "IBinder" ) ) . addStatement ( "return binder" ) . build ( ) ) . addSuperinterface ( ClassName . get ( "android.os" , "IInterface" ) ) ; return staticBinderWrapperClassBuilder . build ( ) ; }
Add the static inner Binder wrapper