/** * Setting default values that must be accessible using [NSUserDefaults standardUserDefaults] * * @param property Initial property name to store default value for. */ private void _init(final String property) { if(null == store.objectForKey(property)) { // Set the default value this.setProperty(property, this.getDefault(property)); } }
/** * Load and convert from native storage into cache */ private String loadProperty(final String property) { final NSObject value = store.objectForKey(property); if(null == value) { final String d = this.getDefault(property); return null == d ? MISSING_PROPERTY : d; } // Customized property found if(value.isKindOfClass(Rococoa.createClass("NSString", NSString._Class.class))) { return value.toString(); } if(value.isKindOfClass(Rococoa.createClass("NSArray", NSArray._Class.class))) { return StringUtils.join(this.toList(Rococoa.cast(value, NSArray.class)), LIST_SEPERATOR); } log.warn(String.format("Unknown type for property %s", property)); return value.toString(); }