jrubyfx-fxmlloader-master 0.4.master.2015.9.30-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +25 -0
- data/README +17 -0
- data/Rakefile +72 -0
- data/lib/FXMLLoader-j8.jar +0 -0
- data/lib/fxmlloader/elts.rb +576 -0
- data/lib/fxmlloader/fxml_jit_info.rb +158 -0
- data/lib/fxmlloader/j8_expression_value.rb +290 -0
- data/lib/fxmlloader/real_elts.rb +708 -0
- data/lib/fxmlloader/rorba.rb +107 -0
- data/lib/fxmlloader/rrba.rb +769 -0
- data/lib/fxmlloader/value_elts.rb +257 -0
- data/lib/jrubyfx-fxmlloader.rb +800 -0
- metadata +57 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
=begin
|
2
|
+
* Copyright (c) 2010, 2013, 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
|
23
|
+
* questions.
|
24
|
+
*/
|
25
|
+
=end
|
26
|
+
|
27
|
+
#/**
|
28
|
+
# * Exposes Java Bean properties of an object via the {@link Mapend interface.
|
29
|
+
# * A call to {@link Map#get(Object)end invokes the getter for the corresponding
|
30
|
+
# * property, and a call to {@link Map#put(Object, Object)end invokes the
|
31
|
+
# * property's setter. Appending a "Property" suffix to the key returns the
|
32
|
+
# * corresponding property model.
|
33
|
+
# */
|
34
|
+
class RubyObjectWrapperBeanAdapter
|
35
|
+
# private final Object @bean;
|
36
|
+
|
37
|
+
|
38
|
+
@@globalMethodCache = {}
|
39
|
+
|
40
|
+
GET_PREFIX = "get"
|
41
|
+
IS_PREFIX = "is"
|
42
|
+
SET_PREFIX = "set"
|
43
|
+
PROPERTY_SUFFIX = "Property"
|
44
|
+
|
45
|
+
VALUE_OF_METHOD_NAME = "valueOf"
|
46
|
+
|
47
|
+
# static
|
48
|
+
# contextClassLoader = Thread.currentThread().getContextClassLoader();
|
49
|
+
#
|
50
|
+
# if (contextClassLoader == nil)
|
51
|
+
# raise ArgumentError.new();
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
|
55
|
+
#Creates a Bean.new adapter.
|
56
|
+
#
|
57
|
+
#@param @bean
|
58
|
+
#The Bean object to wrap.
|
59
|
+
def initialize(bean)
|
60
|
+
@bean = bean
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
def getBean()
|
65
|
+
return @bean;
|
66
|
+
end
|
67
|
+
|
68
|
+
def [](key)
|
69
|
+
return @bean.send("get#{key[0].upcase}#{key[1..-1]}")
|
70
|
+
end
|
71
|
+
|
72
|
+
def []=(key, value)
|
73
|
+
if (key == nil)
|
74
|
+
raise "NULL PTR"
|
75
|
+
end
|
76
|
+
ty = getType(key)
|
77
|
+
co = coerce(value, ty)
|
78
|
+
@bean.send("set#{key[0].upcase}#{key[1..-1]}", co);
|
79
|
+
return nil;
|
80
|
+
end
|
81
|
+
|
82
|
+
def read_only?(key)
|
83
|
+
if (key == nil)
|
84
|
+
raise "NULL PTR"
|
85
|
+
end
|
86
|
+
@bean.methods.include? "set#{key[0].upcase}#{key[1..-1]}"
|
87
|
+
end
|
88
|
+
|
89
|
+
def getType(key)
|
90
|
+
if (key == nil)
|
91
|
+
raise ArgumentError.new();
|
92
|
+
end
|
93
|
+
@bean.send(key + "GetType")
|
94
|
+
end
|
95
|
+
|
96
|
+
def getPropertyModel(key)
|
97
|
+
if (key == nil)
|
98
|
+
raise ArgumentError.new();
|
99
|
+
end
|
100
|
+
|
101
|
+
return @bean.send("#{key}Property")
|
102
|
+
end
|
103
|
+
|
104
|
+
def coerce(value, type)
|
105
|
+
RubyWrapperBeanAdapter.coerce(value, type)
|
106
|
+
end
|
107
|
+
end
|