EOS 2  1.1.0
Einfache Objektbasierte Sprache
PropertyViewer.java
gehe zur Dokumentation dieser Datei
1 package de.lathanda.eos.baseparser;
2 
3 import java.lang.reflect.Method;
4 
5 import de.lathanda.eos.vm.MObject;
6 
7 public abstract class PropertyViewer {
8  public final String name;
9  private PropertyViewer(String name) {
10  this.name = name;
11  }
12  public abstract Object getValue();
13  public static class SystemTypePropertyViewer extends PropertyViewer {
14  private final Method method;
15  private final Object target;
16  public SystemTypePropertyViewer(String name, Method method, Object target) {
17  super(name);
18  this.method = method;
19  this.target = target;
20  }
21  public Object getValue() {
22  try {
23  return method.invoke(target);
24  } catch (Exception e) {
25  return "";
26  }
27  }
28  }
29  public static class UserClassPropertyViewer extends PropertyViewer {
30  private final MObject target;
31  public UserClassPropertyViewer(String name, Object target) {
32  super(name);
33  this.target = (MObject)target;
34  }
35  public Object getValue() {
36  try {
37  return target.getProperty(name);
38  } catch (Exception e) {
39  return "";
40  }
41  }
42  }
43 }
SystemTypePropertyViewer(String name, Method method, Object target)
Object getProperty(String s)
Definition: MObject.java:30
Impressum