title: How to use ObjectProperty<?> with fxml and PropertyValueFactory?
body: <p>I have this <code>TableView</code></p>
  
  <pre><code>&lt;TableView fx:id="tableView"&gt;
    &lt;columns&gt;
      &lt;TableColumn prefWidth="220.0" text="Source"&gt;
        &lt;cellValueFactory&gt;
          &lt;PropertyValueFactory property="sourceContract" /&gt;
        &lt;/cellValueFactory&gt;
      &lt;/TableColumn&gt;
    &lt;/columns&gt;
    &lt;items&gt;
      &lt;FXCollections fx:factory="observableArrayList"&gt;
        &lt;GridRowModel sourceContract="some contract" /&gt;
      &lt;/FXCollections&gt;
    &lt;/items&gt;
  &lt;/TableView&gt;
  </code></pre>
  
  <p>and these classes</p>
  
  <pre><code>public class GridRowModel {
  
    private ObjectProperty&lt;ContractConfig&gt; sourceContract = new SimpleObjectProperty&lt;&gt;();
  
    public GridRowModel() {
    }
  
    public ObjectProperty&lt;ContractConfig&gt; sourceContractProperty() {
      return sourceContract;
    }
  
    public ContractConfig getSourceContract() {
      return sourceContract.get();
    }
  
    public void setSourceContract(ContractConfig sourceContract) {
      this.sourceContract.set(sourceContract);
    }
  }
  
  public class ContractConfig {
  
    private String name;
    private String userFriendlyName;
  
    public ContractConfig() {
    }
  
    public ContractConfig(String name) {
      this.name = name;
    }
  
    public void setName(String name) {
      this.name = name;
    }
  
    public void setUserFriendlyName(String userFriendlyName) {
      this.userFriendlyName = userFriendlyName;
    }
  
    public String getName() {
      return name;
    }
  
    public String getUserFriendlyName() {
      return userFriendlyName;
    }
  }
  </code></pre>
  
  <p>I get this obvious error:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Unable to coerce some contract to class com.ui.util.ContractConfig.
      at com.sun.javafx.fxml.BeanAdapter.coerce(BeanAdapter.java:496)
      at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:258)
      at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:54)
  </code></pre>
  
  <p>I also tried this</p>
  
  <pre><code>  public void setSourceContract(String sourceContract) {
      ContractConfig cc = new ContractConfig();
      cc.setUserFriendlyName(sourceContract);
      this.sourceContract.set(cc);
    }
  </code></pre>
  
  <p>But I get this error</p>
  
  <pre><code>Caused by: com.sun.javafx.fxml.PropertyNotFoundException: Property "sourceContract" does not exist or is read-only.
      at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:253)
      at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:54)
      at javafx.fxml.FXMLLoader$Element.applyProperty(FXMLLoader.java:512) 
  </code></pre>
  
  <p>Is it possible to use ObjectProperty with FXML values and if so, how can I use my ContractConfig object in the FXML?</p>