I am porting a lot of code from PHP to Java (an Android application). Everything is done but I am facing a problem here,
I got this PHP code:
class SenderKeyGroupData{
const MESSAGE = 1;
const SENDER_KEY = 2;
/* @var array Field descriptors */
protected static $fields = array(
self::MESSAGE => array(
'name' => 'message',
'required' => false,
'type' => 7,
),
self::SENDER_KEY => array(
'name' => 'sender_key',
'required' => false,
'type' => "SenderKeyGroupMessage",
),
);
However I want this code in Java, for example I created this Java code:
class SenderKeyGroupData {
int MESSAGE = 1; // Must be const
int SENDER_KEY = 2; // Must be const
// These two Maps must be in the $fields array?
Map MESSAGE = new HashMap(); //Duplicate conflict here
MESSAGE.put("name", "message");
MESSAGE.put("required", false); // Map can't contain booleans?
MESSAGE.put("type", "7");
Map SENDER_KEY = new HashMap(); //Duplicate conflict here
SENDER_KEY.put("name", "sender_key");
SENDER_KEY.put("required", false); // Map can't contain booleans?
SENDER_KEY.put("type", "SenderKeyGroupMessage");
}
I described the problems as comments. All ideas are welcome.
Note that the const contain 1 and 2 as value in the constructor, but also get an array assigned. So please give an example instead of pointing it as duplicate.