当字段名称中有空格时@PropertyName无法正常工作

时间:2017-10-30 07:28:36

标签: android firebase firebase-realtime-database

我在firebase数据库中有一个名为“Serial Number”的字段,我想向android应用程序显示它的值。我有用户@PropertyName注释来通过模型类访问它。

@PropertyName("Serial Number")
private String serialNumber;

但它不起作用,如果我从firebase数据库以及模型类中删除空间,它工作正常。但是如何在字段名称中使用空格呢?

1 个答案:

答案 0 :(得分:0)

在将变量名称声明为@PropertyName的同时,您需要为getter和setter添加@PropertyName,如下所示:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
相关问题