1 /*
2 * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
73 import javax.xml.stream.XMLStreamException;
74 import javax.xml.stream.XMLStreamReader;
75 import javax.xml.stream.util.StreamReaderDelegate;
76
77 import com.sun.javafx.beans.IDProperty;
78 import com.sun.javafx.fxml.BeanAdapter;
79 import com.sun.javafx.fxml.ParseTraceElement;
80 import com.sun.javafx.fxml.PropertyNotFoundException;
81 import com.sun.javafx.fxml.expression.Expression;
82 import com.sun.javafx.fxml.expression.ExpressionValue;
83 import com.sun.javafx.fxml.expression.KeyPath;
84 import static com.sun.javafx.FXPermissions.MODIFY_FXML_CLASS_LOADER_PERMISSION;
85 import com.sun.javafx.fxml.FXMLLoaderHelper;
86 import com.sun.javafx.fxml.MethodHelper;
87 import java.net.MalformedURLException;
88 import java.security.AccessController;
89 import java.security.PrivilegedAction;
90 import java.util.EnumMap;
91 import java.util.Locale;
92 import java.util.StringTokenizer;
93 import sun.reflect.misc.ConstructorUtil;
94 import sun.reflect.misc.MethodUtil;
95 import sun.reflect.misc.ReflectUtil;
96
97 /**
98 * Loads an object hierarchy from an XML document.
99 * For more information, see the
100 * <a href="doc-files/introduction_to_fxml.html">Introduction to FXML</a>
101 * document.
102 *
103 * @since JavaFX 2.0
104 */
105 public class FXMLLoader {
106
107 // Indicates permission to get the ClassLoader
108 private static final RuntimePermission GET_CLASSLOADER_PERMISSION =
109 new RuntimePermission("getClassLoader");
110
111 // Instance of StackWalker used to get caller class (must be private)
112 private static final StackWalker walker =
113 AccessController.doPrivileged((PrivilegedAction<StackWalker>) () ->
114 StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE));
115
|
1 /*
2 * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
73 import javax.xml.stream.XMLStreamException;
74 import javax.xml.stream.XMLStreamReader;
75 import javax.xml.stream.util.StreamReaderDelegate;
76
77 import com.sun.javafx.beans.IDProperty;
78 import com.sun.javafx.fxml.BeanAdapter;
79 import com.sun.javafx.fxml.ParseTraceElement;
80 import com.sun.javafx.fxml.PropertyNotFoundException;
81 import com.sun.javafx.fxml.expression.Expression;
82 import com.sun.javafx.fxml.expression.ExpressionValue;
83 import com.sun.javafx.fxml.expression.KeyPath;
84 import static com.sun.javafx.FXPermissions.MODIFY_FXML_CLASS_LOADER_PERMISSION;
85 import com.sun.javafx.fxml.FXMLLoaderHelper;
86 import com.sun.javafx.fxml.MethodHelper;
87 import java.net.MalformedURLException;
88 import java.security.AccessController;
89 import java.security.PrivilegedAction;
90 import java.util.EnumMap;
91 import java.util.Locale;
92 import java.util.StringTokenizer;
93 import com.sun.javafx.reflect.ConstructorUtil;
94 import com.sun.javafx.reflect.MethodUtil;
95 import com.sun.javafx.reflect.ReflectUtil;
96
97 /**
98 * Loads an object hierarchy from an XML document.
99 * For more information, see the
100 * <a href="doc-files/introduction_to_fxml.html">Introduction to FXML</a>
101 * document.
102 *
103 * @since JavaFX 2.0
104 */
105 public class FXMLLoader {
106
107 // Indicates permission to get the ClassLoader
108 private static final RuntimePermission GET_CLASSLOADER_PERMISSION =
109 new RuntimePermission("getClassLoader");
110
111 // Instance of StackWalker used to get caller class (must be private)
112 private static final StackWalker walker =
113 AccessController.doPrivileged((PrivilegedAction<StackWalker>) () ->
114 StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE));
115
|