Подробнее см. По этой ссылке Библиотека Джексона .
@Entity
public class Partida implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String timeA;
private String timeB;
private boolean visitante;
public Partida(){
//Default constructor required here
}
@OneToMany(mappedBy = "partida", fetch = FetchType.LAZY, cascade =
CascadeType.ALL)
private List sets;
public List getSets() {
return sets;
}
public void setSets(List sets) {
this.sets = sets;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTimeA() {
return timeA;
}
// Mocado o valor pois o Time A sempre e a Sao Judas
public void setTimeA(String timeA) {
this.timeA = timeA;
}
public String getTimeB() {
return timeB;
}
public void setTimeB(String timeB) {
this.timeB = timeB;
}
public boolean isVisitante() {
return visitante;
}
public void setVisitante(boolean visitante) {
this.visitante = visitante;
}
}
Если проблема не решена, попробуйте JSON Creator
@JsonCreator
public Partida(@JsonProperty("id") Long id, @JsonProperty("timeA") String
timeA, @JsonProperty("timeB") String timeB, @JsonProperty("desc") boolean
visitante) {
this.id = id;
this.timeA = timeA;
this.timeB= timeB;
this.visitante= visitante;
}
Хорошо, я здесь - то, что я сделал, и не настолько ужасный:
/// <summary>
/// Editable combo box which updates the data model on the following:
/// 1. Select## Heading ##ion changed
/// 2. Lost focus
/// 3. Enter or Return pressed
///
/// In order for this to work, the EditableComboBox requires the follows, when binding:
/// The data model value should be bounded to the Text property of the ComboBox
/// The binding expression UpdateSourceTrigger property should be set to LostFocus
/// e.g. in XAML:
/// <PmsEditableComboBox Text="{Binding Path=MyValue, UpdateSourceTrigger=LostFocus}"
/// ItemsSource="{Binding Path=MyMenu}"/>
/// </summary>
public class PmsEditableComboBox : ComboBox
{
/// <summary>
/// Initializes a new instance of the <see cref="PmsEditableComboBox"/> class.
/// </summary>
public PmsEditableComboBox()
: base()
{
// When TextSearch enabled we'll get some unwanted behaviour when typing
// (i.e. the content is taken from the DropDown instead from the text)
IsTextSearchEnabled = false;
IsEditable = true;
}
/// <summary>
/// Use KeyUp and not KeyDown because when the DropDown is opened and Enter is pressed
/// We'll get only KeyUp event
/// </summary>
protected override void OnKeyUp(KeyEventArgs e)
{
base.OnKeyUp(e);
// Update binding source on Enter
if (e.Key == Key.Return || e.Key == Key.Enter)
{
UpdateDataSource();
}
}
/// <summary>
/// The Text property binding will be updated when selection changes
/// </summary>
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
{
base.OnSelectionChanged(e);
UpdateDataSource();
}
/// <summary>
/// Updates the data source.
/// </summary>
private void UpdateDataSource()
{
BindingExpression expression = GetBindingExpression(ComboBox.TextProperty);
if (expression != null)
{
expression.UpdateSource();
}
}
}
Самый простой способ сделать это должно использовать свойство UpdateSourceTrigger на привязке. Вы не можете соответствовать своему текущему поведению точно, но можно найти, что это сопоставимо.
Свойство UpdateSourceTrigger управляет когда цель обязательных обновлений источник. Различные средства управления WPF имеют различные значения по умолчанию для этого свойства при привязке.
Вот Ваши опции:
UpdateSourceTrigger. Значение по умолчанию = Позволяет целевому управлению определять режим UpdateSourceTrigger.
UpdateSourceTrigger. Явный = Только обновляют источник, когда кто-то называет BindingExpression. UpdateSource ();
UpdateSourceTrigger. LostFocus = Автоматически обновляют обязательный источник каждый раз, когда цель освобождает фокус. Таким образом, изменение может быть завершено, и затем привязка обновляется после того, как пользователь идет дальше.
UpdateSourceTrigger. PropertyChanged = Каждый раз, когда DependencyProperty на целевых изменениях оценивает источник, обновляется immediatly. Большинство UserControls не принимает значение по умолчанию к этому свойству, потому что оно требует более обязательных обновлений (может быть проблема производительности).