MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / type

Method type

src/main/java/field/utility/Dict.java:243–291  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241 }
242
243 public <T> Prop<T> type() {
244
245 Prop on = this;
246 if (!isCanon()) {
247 Prop<T> already = (Prop<T>) findCanon();
248 if (already == null) {
249 toCanon();
250 on.setCanon();
251 } else {
252 on = already;
253 }
254 }
255
256 Class c = _getCallerClass(2);
257
258 on.definedInClass = c;
259
260 Field f = null;
261 try {
262 f = c.getField(name);
263 } catch (NoSuchFieldException e) {
264
265 try {
266 f = c.getField("_" + name);
267 } catch (NoSuchFieldException e3) {
268 if (name.startsWith("_")) try {
269 f = c.getField(name.substring(1));
270 } catch (NoSuchFieldException e1) {
271 if (name.startsWith("__")) try {
272 f = c.getField(name.substring(1));
273 } catch (NoSuchFieldException e2) {
274 }
275 }
276
277 }
278
279
280 }
281 if (f == null) {
282 throw new IllegalStateException(" cannot type a Dict.Prop<T> that we can't find. Name is :" + name + " class is :" + c);
283 }
284
285 on.typeInformation = Conversions.linearize(f.getGenericType());
286
287 on.typeInformation.remove(0);
288
289
290 return (Prop<T>) on;
291 }
292
293 private Class _getCallerClass(int i) {
294 return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).walk(x -> {

Callers 15

sound file.box.jsFile · 0.80
webcam.box.jsFile · 0.80
t_fadeplane.box.jsFile · 0.80
t_update.box.jsFile · 0.80
window.box.jsFile · 0.80
sound file.box.jsFile · 0.80
viewport.box.jsFile · 0.80
some fline.box.jsFile · 0.80
triangles.box.jsFile · 0.80

Calls 8

isCanonMethod · 0.95
findCanonMethod · 0.95
toCanonMethod · 0.95
setCanonMethod · 0.95
_getCallerClassMethod · 0.95
linearizeMethod · 0.95
getFieldMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected