/
JavaClassConfiguration.java
65 lines (50 loc) · 1.73 KB
/
JavaClassConfiguration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.jruby.javasupport.util;
import java.util.*;
import com.kenai.jffi.Array;
public class JavaClassConfiguration
{
private static final Set<String> DEFAULT_EXCLUDES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
//TODO: note this is the original list
"class", "finalize", "initialize", "java_class", "java_object", "__jcreate!",
// TODO: note these are new additions
"java_interfaces", "java_proxy_class", "java_proxy_class="
)));
public boolean callInitialize = true;
public boolean allMethods = true;
public boolean allClassMethods = true; // TODO: ensure defaults are sane
public boolean javaConstructable = true;
public List<Class<?>[]> extraCtors = new ArrayList<>();
// for java proxies
public boolean allCtors = false;
public boolean rubyConstructable = true; //
public boolean IroCtors = true;
public Map<String, String> renamedMethods = new HashMap<>();
public String javaCtorMethodName = "initialize";
private Set<String> excluded = null;
private Set<String> included = null;
//TODO: renames?
public synchronized Set<String> getExcluded()
{
if (excluded == null) return DEFAULT_EXCLUDES;
return excluded ;
}
public synchronized void exclude(String name)
{
if (included == null) included = new HashSet<>();
if (excluded == null) excluded = new HashSet<>(DEFAULT_EXCLUDES);
excluded.add(name);
included.remove(name);
}
public synchronized Set<String> getIncluded()
{
if (included == null) return Collections.EMPTY_SET;
return included;
}
public synchronized void include(String name)
{
if (included == null) included = new HashSet<>();
if (excluded == null) excluded = new HashSet<>(DEFAULT_EXCLUDES);
included.add(name);
excluded.remove(name);
}
}