MCPcopy Index your code
hub / github.com/processing/processing / parseInto

Method parseInto

core/src/processing/data/Table.java:1031–1171  ·  view source on GitHub ↗

incomplete, do not use

(Object enclosingObject, String fieldName)

Source from the content-addressed store, hash-verified

1029
1030 /** incomplete, do not use */
1031 public void parseInto(Object enclosingObject, String fieldName) {
1032 Class<?> target = null;
1033 Object outgoing = null;
1034 Field targetField = null;
1035 try {
1036 // Object targetObject,
1037 // Class target -> get this from the type of fieldName
1038// Class sketchClass = sketch.getClass();
1039 Class<?> sketchClass = enclosingObject.getClass();
1040 targetField = sketchClass.getDeclaredField(fieldName);
1041// PApplet.println("found " + targetField);
1042 Class<?> targetArray = targetField.getType();
1043 if (!targetArray.isArray()) {
1044 // fieldName is not an array
1045 } else {
1046 target = targetArray.getComponentType();
1047 outgoing = Array.newInstance(target, getRowCount());
1048 }
1049 } catch (NoSuchFieldException e) {
1050 e.printStackTrace();
1051 } catch (SecurityException e) {
1052 e.printStackTrace();
1053 }
1054
1055// Object enclosingObject = sketch;
1056// PApplet.println("enclosing obj is " + enclosingObject);
1057 Class<?> enclosingClass = target.getEnclosingClass();
1058 Constructor<?> con = null;
1059
1060 try {
1061 if (enclosingClass == null) {
1062 con = target.getDeclaredConstructor(); //new Class[] { });
1063// PApplet.println("no enclosing class");
1064 } else {
1065 con = target.getDeclaredConstructor(new Class[] { enclosingClass });
1066// PApplet.println("enclosed by " + enclosingClass.getName());
1067 }
1068 if (!con.isAccessible()) {
1069// System.out.println("setting constructor to public");
1070 con.setAccessible(true);
1071 }
1072 } catch (SecurityException e) {
1073 e.printStackTrace();
1074 } catch (NoSuchMethodException e) {
1075 e.printStackTrace();
1076 }
1077
1078 Field[] fields = target.getDeclaredFields();
1079 ArrayList<Field> inuse = new ArrayList<>();
1080 for (Field field : fields) {
1081 String name = field.getName();
1082 if (getColumnIndex(name, false) != -1) {
1083// System.out.println("found field " + name);
1084 if (!field.isAccessible()) {
1085// PApplet.println(" changing field access");
1086 field.setAccessible(true);
1087 }
1088 inuse.add(field);

Callers

nothing calls this directly

Calls 15

getRowCountMethod · 0.95
getColumnIndexMethod · 0.95
rowsMethod · 0.95
setMethod · 0.65
getStringMethod · 0.65
setIntMethod · 0.65
getIntMethod · 0.65
setLongMethod · 0.65
getLongMethod · 0.65
setFloatMethod · 0.65
getFloatMethod · 0.65
setDoubleMethod · 0.65

Tested by

no test coverage detected