changeset 5245:b182b0b07282

RT-33052 Generify FXMLLoader.load instance methods Reviewed-by: ekrejcir
author Martin Sladecek <martin.sladecek@oracle.com>
date Thu, 03 Oct 2013 14:01:58 +0200
parents 98b9cd9ee0fc
children abbc53855b43
files modules/fxml/src/main/java/javafx/fxml/FXMLLoader.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/modules/fxml/src/main/java/javafx/fxml/FXMLLoader.java	Thu Oct 03 13:49:18 2013 +0200
+++ b/modules/fxml/src/main/java/javafx/fxml/FXMLLoader.java	Thu Oct 03 14:01:58 2013 +0200
@@ -2388,13 +2388,13 @@
      * The loaded object hierarchy.
      * @since JavaFX 2.1
      */
-    public Object load() throws IOException {
+    public <T> T load() throws IOException {
         if (location == null) {
             throw new IllegalStateException("Location is not set.");
         }
 
         InputStream inputStream = null;
-        Object value;
+        T value;
         try {
             inputStream = location.openStream();
             value = load(inputStream);
@@ -2423,7 +2423,7 @@
      * The loaded object hierarchy.
      */
     @SuppressWarnings("dep-ann")
-    public Object load(InputStream inputStream) throws IOException {
+    public <T> T load(InputStream inputStream) throws IOException {
         if (inputStream == null) {
             throw new NullPointerException("inputStream is null.");
         }
@@ -2564,7 +2564,7 @@
         // Clear the parser
         xmlStreamReader = null;
 
-        return root;
+        return (T)root;
     }
 
     private void clearImports() {