< prev index next >

modules/javafx.fxml/src/main/java/com/sun/javafx/fxml/builder/ProxyBuilder.java

Print this page


   1 /*
   2  * Copyright (c) 2010, 2016, 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


  28 import com.sun.javafx.fxml.ModuleHelper;
  29 import java.lang.annotation.Annotation;
  30 import java.lang.reflect.Array;
  31 import java.lang.reflect.Constructor;
  32 import java.lang.reflect.Method;
  33 import java.lang.reflect.Modifier;
  34 import java.util.AbstractMap;
  35 import java.util.ArrayList;
  36 import java.util.Collection;
  37 import java.util.Comparator;
  38 import java.util.HashMap;
  39 import java.util.HashSet;
  40 import java.util.LinkedHashMap;
  41 import java.util.LinkedList;
  42 import java.util.List;
  43 import java.util.Map;
  44 import java.util.Set;
  45 import java.util.TreeSet;
  46 import javafx.beans.NamedArg;
  47 import javafx.util.Builder;
  48 import sun.reflect.misc.ConstructorUtil;
  49 import sun.reflect.misc.ReflectUtil;
  50 
  51 /**
  52  * Using this builder assumes that some of the constructors of desired class
  53  * with arguments are annotated with NamedArg annotation.
  54  */
  55 public class ProxyBuilder<T> extends AbstractMap<String, Object> implements Builder<T> {
  56 
  57     private Class<?> type;
  58 
  59     private final Map<Constructor, Map<String, AnnotationValue>> constructorsMap;
  60     private final Map<String, Property> propertiesMap;
  61     private final Set<Constructor> constructors;
  62     private Set<String> propertyNames;
  63 
  64     private boolean hasDefaultConstructor = false;
  65     private Constructor defaultConstructor;
  66 
  67     private static final String SETTER_PREFIX = "set";
  68     private static final String GETTER_PREFIX = "get";
  69 


   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


  28 import com.sun.javafx.fxml.ModuleHelper;
  29 import java.lang.annotation.Annotation;
  30 import java.lang.reflect.Array;
  31 import java.lang.reflect.Constructor;
  32 import java.lang.reflect.Method;
  33 import java.lang.reflect.Modifier;
  34 import java.util.AbstractMap;
  35 import java.util.ArrayList;
  36 import java.util.Collection;
  37 import java.util.Comparator;
  38 import java.util.HashMap;
  39 import java.util.HashSet;
  40 import java.util.LinkedHashMap;
  41 import java.util.LinkedList;
  42 import java.util.List;
  43 import java.util.Map;
  44 import java.util.Set;
  45 import java.util.TreeSet;
  46 import javafx.beans.NamedArg;
  47 import javafx.util.Builder;
  48 import com.sun.javafx.reflect.ConstructorUtil;
  49 import com.sun.javafx.reflect.ReflectUtil;
  50 
  51 /**
  52  * Using this builder assumes that some of the constructors of desired class
  53  * with arguments are annotated with NamedArg annotation.
  54  */
  55 public class ProxyBuilder<T> extends AbstractMap<String, Object> implements Builder<T> {
  56 
  57     private Class<?> type;
  58 
  59     private final Map<Constructor, Map<String, AnnotationValue>> constructorsMap;
  60     private final Map<String, Property> propertiesMap;
  61     private final Set<Constructor> constructors;
  62     private Set<String> propertyNames;
  63 
  64     private boolean hasDefaultConstructor = false;
  65     private Constructor defaultConstructor;
  66 
  67     private static final String SETTER_PREFIX = "set";
  68     private static final String GETTER_PREFIX = "get";
  69 


< prev index next >