Clover icon

Coverage Report

  1. Project Clover database Thu Jan 15 2026 16:11:02 GMT
  2. Package swingjs.api

File Interface.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
62% of files have more coverage

Code metrics

4
14
2
1
95
47
7
0.5
7
2
3.5

Classes

Class Line # Actions
Interface 31 14 7
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /* $RCSfile$
2    * $Author$
3    * $Date$
4    * $Revision$
5    *
6    * Some portions of this file have been modified by Robert Hanson hansonr.at.stolaf.edu 2012-2017
7    * for use in SwingJS via transpilation into JavaScript using Java2Script.
8    *
9    * Copyright (C) 2006 The Jmol Development Team
10    *
11    * Contact: jmol-developers@lists.sf.net
12    *
13    * This library is free software; you can redistribute it and/or
14    * modify it under the terms of the GNU Lesser General Public
15    * License as published by the Free Software Foundation; either
16    * version 2.1 of the License, or (at your option) any later version.
17    *
18    * This library is distributed in the hope that it will be useful,
19    * but WITHOUT ANY WARRANTY; without even the implied warranty of
20    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21    * Lesser General Public License for more details.
22    *
23    * You should have received a copy of the GNU Lesser General Public
24    * License along with this library; if not, write to the Free Software
25    * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26    * 02110-1301, USA.
27    */
28   
29    package swingjs.api;
30   
 
31    public class Interface
32    {
33   
34    private static String instances = "";
35   
 
36  0 toggle public static Object getInstanceWithParams(String name,
37    Class<?>[] classes, Object... params)
38    {
39  0 try
40    {
41  0 Class<?> cl = Class.forName(name);
42  0 return cl.getConstructor(classes).newInstance(params);
43    } catch (Exception e)
44    {
45  0 return null;
46    }
47    }
48   
 
49  0 toggle public static Object getInstance(String name, boolean isQuiet)
50    {
51  0 Object x = null;
52    /**
53    * @j2sNative
54    *
55    * Clazz._isQuietLoad = isQuiet;
56    */
57    {
58    }
59  0 try
60    {
61  0 if (!isQuiet && instances.indexOf(name + ";") <= 0)
62    {
63  0 System.out.println(
64    "swingjs.api.Interface creating instance of " + name);
65  0 instances += name + ";";
66    }
67  0 Class<?> y = Class.forName(name);
68  0 if (y != null)
69  0 x = y.getDeclaredConstructor().newInstance();
70    } catch (Throwable e)
71    {
72  0 System.out
73    .println("Swingjs.api.Interface Error creating instance for "
74    + name + ": \n" + e);
75    /**
76    * @j2sNative
77    *
78    * if (e.stack)System.out.println(e.stack);
79    */
80    {
81    }
82    } finally
83    {
84    /**
85    * @j2sNative
86    *
87    * Clazz._isQuietLoad = false;
88    */
89    {
90    }
91    }
92  0 return x;
93    }
94   
95    }