@Test public void testPrintObject() { TestObj testObj = new TestObj(); Map<String, String> allPropsAndVals = AbstractSystemSettingsUtils.getAllCurrentPropsAndValues(testObj); assertTrue(allPropsAndVals.containsKey("kControlLoopPeriod")); assertTrue(allPropsAndVals.containsKey("kNetworkTableUpdateRate")); String kControl = allPropsAndVals.remove("kControlLoopPeriod"); assertEquals(Double.toString(TestObj.kControlLoopPeriod), kControl); String network = allPropsAndVals.remove("kNetworkTableUpdateRate"); assertEquals(Double.toString(TestObj.kControlLoopPeriod), network); assertTrue(allPropsAndVals.isEmpty()); }
public static Map<String,String> getAllCurrentPropsAndValues(Object obj) { return Arrays.stream(obj.getClass().getFields()).filter(aField->Modifier.isStatic( aField.getModifiers())).collect( Collectors.toMap((aField)->aField.getName(),(aField)->{ Object returnObj = ""; try { returnObj = aField.get(obj); if(returnObj == null) { returnObj = "null"; } } catch(Exception e) { returnObj = "unk"; } return returnObj.toString(); })); }
AbstractSystemSettingsUtils { public static Map<String,String> getAllCurrentPropsAndValues(Object obj) { return Arrays.stream(obj.getClass().getFields()).filter(aField->Modifier.isStatic( aField.getModifiers())).collect( Collectors.toMap((aField)->aField.getName(),(aField)->{ Object returnObj = ""; try { returnObj = aField.get(obj); if(returnObj == null) { returnObj = "null"; } } catch(Exception e) { returnObj = "unk"; } return returnObj.toString(); })); } }
AbstractSystemSettingsUtils { public static Map<String,String> getAllCurrentPropsAndValues(Object obj) { return Arrays.stream(obj.getClass().getFields()).filter(aField->Modifier.isStatic( aField.getModifiers())).collect( Collectors.toMap((aField)->aField.getName(),(aField)->{ Object returnObj = ""; try { returnObj = aField.get(obj); if(returnObj == null) { returnObj = "null"; } } catch(Exception e) { returnObj = "unk"; } return returnObj.toString(); })); } private  AbstractSystemSettingsUtils(); }
AbstractSystemSettingsUtils { public static Map<String,String> getAllCurrentPropsAndValues(Object obj) { return Arrays.stream(obj.getClass().getFields()).filter(aField->Modifier.isStatic( aField.getModifiers())).collect( Collectors.toMap((aField)->aField.getName(),(aField)->{ Object returnObj = ""; try { returnObj = aField.get(obj); if(returnObj == null) { returnObj = "null"; } } catch(Exception e) { returnObj = "unk"; } return returnObj.toString(); })); } private  AbstractSystemSettingsUtils(); static void loadPracticeSettings(SystemSettings sysSettings); static void copyOverValues(Object fromObject, Object destinationObject); static Map<String,String> getAllCurrentPropsAndValues(Object obj); static boolean isPracticeBot(); }
AbstractSystemSettingsUtils { public static Map<String,String> getAllCurrentPropsAndValues(Object obj) { return Arrays.stream(obj.getClass().getFields()).filter(aField->Modifier.isStatic( aField.getModifiers())).collect( Collectors.toMap((aField)->aField.getName(),(aField)->{ Object returnObj = ""; try { returnObj = aField.get(obj); if(returnObj == null) { returnObj = "null"; } } catch(Exception e) { returnObj = "unk"; } return returnObj.toString(); })); } private  AbstractSystemSettingsUtils(); static void loadPracticeSettings(SystemSettings sysSettings); static void copyOverValues(Object fromObject, Object destinationObject); static Map<String,String> getAllCurrentPropsAndValues(Object obj); static boolean isPracticeBot();  }