I have custom LayoutTree and I want to add attribute "speak" in XMLLayout class like so:
<layout stroke="NORTH_WEST">
<XMLLayout label=".,!" speak="Знаки препинания">
<characters stroke="EAST">
<XMLCharacterGroup>.</XMLCharacterGroup>
</characters>
</XMLLayout>
</layout>
So I add fild in class (without my addiction it works perfect):
@Root
private static class XMLLayout {
private static final String EMPTY_LABEL = "";
@Attribute(required=false)
private String label;
@Attribute(required=false)
private String speak;
@ElementMapUnion({
@ElementMap(entry="characters", key="stroke", attribute=true, inline=true, valueType=XMLCharacterGroup.class),
@ElementMap(entry="controlCharacter", key="stroke", attribute=true, inline=true, valueType=XMLControlCharacter.class)
})
private Map<StrokeType, XMLStrokeCharacters> strokeToCharacters =
new HashMap<StrokeType, XMLStrokeCharacters>(StrokeType.values().length);
// constructors
public String getLabel() {
if (label == null)
label = generateDefaultLabel();
return label;
}
public void setLabel(String label) {
if (label == null)
throw new AssertionError();
this.label = label;
}
public String getSpeak() {
if(speak == null)
speak = "Тэг пуст";
return speak;
}
public void setSpeak(String speak)
{
if(speak == null)
throw new AssertionError();
this.speak = speak;
}
// other functions...
}
So "speak" is always empty. If I make required = true, everithing is crush at all, 'cos layout is empty. What's wrong?
No comments:
Post a Comment