protected Object decodedValue(String encodedValue) { NSDictionary d = (NSDictionary )NSPropertyListSerialization.propertyListFromString(encodedValue); EOKeyValueUnarchiver u = new EOKeyValueUnarchiver(d); return u.decodeObjectForKey(VALUE); }
public void setNewValue(Object value) { setNewValues(NSPropertyListSerialization.stringFromPropertyList(value)); } }
private boolean shouldThrowException() { return NSPropertyListSerialization.booleanForString(NSProperties.getProperty("ognl.webobjects.WOAssociation.shouldThrowExceptions")); } }
testedJdbcInfo = true; String property = System.getProperty("h2.updateJDBCInfo"); if (NSPropertyListSerialization.booleanForString(property)) { NSLog.out.appendln("Updating H2JDBCInfo.plist enabled:" + property); try { String jdbcInfoContent = NSPropertyListSerialization.stringFromPropertyList(super.jdbcInfo()); File tmpDir = new File(System.getProperty("java.io.tmpdir")); File jdbcInfoFile = new File(tmpDir, "H2JDBCInfo.plist"); jdbcInfo = (NSDictionary<String, Object>) NSPropertyListSerialization.propertyListFromData(new NSData(jdbcInfoStream, 2048), "US-ASCII");
private void loadModel(URL url) { NSDictionary def = (NSDictionary) NSPropertyListSerialization.propertyListWithPathURL(url); for (Enumeration keys = def.allKeys().objectEnumerator(); keys.hasMoreElements();) { String key = (String) keys.nextElement(); NSDictionary indexDef = (NSDictionary) def.objectForKey(key); addIndex(key, indexDef); } }
@Override public void setProperty(Object target, Object name, Object value) throws OgnlException { if (name instanceof String ) { super.setProperty(target, name, value); return; } NSMutableArray array = (NSMutableArray)target; if (name instanceof Number ) { array.replaceObjectAtIndex(value, ((Number)name).intValue()); return; } if ( name instanceof DynamicSubscript ) { int len = array.count(); switch ( ((DynamicSubscript)name).getFlag() ) { case DynamicSubscript.FIRST: if ( len > 0 ) array.replaceObjectAtIndex(value, 0); return; case DynamicSubscript.MID: if ( len > 0 ) array.replaceObjectAtIndex(value, len/2); return; case DynamicSubscript.LAST: if ( len > 0 ) array.replaceObjectAtIndex(value, len-1); return; case DynamicSubscript.ALL: array.setArray( NSPropertyListSerialization.arrayForString( (String) value ) ); return; } } throw new NoSuchPropertyException( target, name ); } }
public void setPossibleValuesString(String pls) { if (!aSubMasterCriteria.nonNumberOrDate()) { NSArray vals = (NSArray)NSPropertyListSerialization.propertyListFromString(pls); aSubMasterCriteria.setRawPossibleValues(vals); } }
public void setOldValue(Object value) { setOldValues(NSPropertyListSerialization.stringFromPropertyList(value)); }
public ObjectMatch tryUnmarshall(SerializerState state, Class clazz, Object o) throws UnmarshallException { try { JSONObject jso = (JSONObject) o; String java_class = jso.getString("javaClass"); if (java_class == null) { throw new UnmarshallException("no type hint"); } String string = jso.getString("bytes"); NSData data = (NSData) NSPropertyListSerialization.propertyListFromString(string); if (NSData.class.isAssignableFrom(clazz)) { return ObjectMatch.OKAY; } throw new UnmarshallException("invalid class " + clazz); } catch (JSONException e) { throw new UnmarshallException("Failed to unmarshall NSData.", e); } }
public Object marshall(SerializerState state, Object p, Object o) throws MarshallException { try { String bytes; if (o instanceof NSData) { bytes = NSPropertyListSerialization.stringFromPropertyList(o); } else { throw new MarshallException("cannot marshall date using class " + o.getClass()); } JSONObject obj = new JSONObject(); if (ser.getMarshallClassHints()) { obj.put("javaClass", o.getClass().getName()); } obj.put("bytes", bytes); return obj; } catch (JSONException e) { throw new MarshallException("Failed to marshall NSData.", e); } } }
protected Object decodedValue() { NSDictionary d = (NSDictionary )NSPropertyListSerialization.propertyListFromString(value()); if(d != null) { EOKeyValueUnarchiver u = new EOKeyValueUnarchiver(d); return u.decodeObjectForKey(VALUE); } return null; }
protected String encodedValue(Object value) { EOKeyValueArchiver archiver = new EOKeyValueArchiver(); archiver.encodeObject(value,VALUE); String encodedValue = NSPropertyListSerialization.stringFromPropertyList(archiver.dictionary()); return encodedValue; }
public NSDictionary modelDictionary() { if(_modelDictionary == null) { if (super.hasBinding("modelDictionary")) { _modelDictionary = (NSDictionary)super.valueForBinding("modelDictionary"); } else { String plistString = plistString(); if (plistString != null) { _modelDictionary = (NSDictionary)NSPropertyListSerialization.propertyListFromString(plistString); } else { _modelDictionary = (NSDictionary)reportDictionary().objectForKey("model"); if(_modelDictionary == null) { log.warn("No modelDictionary found!"); _modelDictionary = NSDictionary.EmptyDictionary; } } log.debug("plistString: {}", plistString); log.debug( "modelDict: {}", _modelDictionary); } } return _modelDictionary; }
public Object unmarshall(SerializerState state, Class clazz, Object o) throws UnmarshallException { try { JSONObject jso = (JSONObject) o; String java_class = jso.getString("javaClass"); if (java_class == null) { throw new UnmarshallException("no type hint"); } String string = jso.getString("bytes"); NSData data = (NSData) NSPropertyListSerialization.propertyListFromString(string); if (NSMutableData.class.equals(clazz)) { NSMutableData mutableData = new NSMutableData(data); state.setSerialized(o, mutableData); return mutableData; } else if (NSData.class.equals(clazz)) { state.setSerialized(o, data); return data; } throw new UnmarshallException("invalid class " + clazz); } catch (JSONException e) { throw new UnmarshallException("Failed to unmarshall NSData.", e); } }
NSDictionary dict = (NSDictionary)NSPropertyListSerialization.propertyListFromString(string);
static public NSDictionary modelDictWithPListString(String plistString) { NSMutableDictionary dict = new NSMutableDictionary(); //WOXMLDecoder decoder = WOXMLDecoder.decoder(); //StringReader stringReader = new StringReader(plistString); //InputSource is = new InputSource(stringReader); // invoke setEncoding (on the input source) if the XML contains multibyte characters //NSDictionary rawdict = (NSDictionary)decoder.decodeRootObject(is); NSDictionary rawdict = (NSDictionary)NSPropertyListSerialization.propertyListFromString(plistString); NSArray mcList = DRReportModel.masterCriteriaList((NSArray)rawdict.objectForKey(GROUP_DEF_KEY)); NSArray attList = DRReportModel.attributeList((NSArray)rawdict.objectForKey(ATTRIBUTE_DEF_KEY)); dict.setObjectForKey(mcList, GROUP_DEF_KEY); dict.setObjectForKey(attList, ATTRIBUTE_DEF_KEY); return dict; }
protected NSArray _ignoredPackages() { NSBundle bundle; String path, content; NSDictionary dic = null; NSMutableArray<NSBundle> allBundles = new NSMutableArray<>(NSBundle.frameworkBundles()); NSMutableArray<String> ignored = new NSMutableArray<>(); for (Enumeration enumerator = allBundles.objectEnumerator(); enumerator.hasMoreElements(); ) { bundle = (NSBundle) enumerator.nextElement(); path = WOApplication.application().resourceManager().pathForResourceNamed("WOIgnoredPackage.plist",bundle.name(),null); if (path != null) { content = _stringFromFileSafely(path); if (content != null) { dic = (NSDictionary) NSPropertyListSerialization.propertyListFromString(content); if (dic != null && dic.containsKey("ignoredPackages")) { @SuppressWarnings("unchecked") NSArray<String> tmpArray = (NSArray<String>) dic.objectForKey("ignoredPackages"); if (tmpArray != null && tmpArray.count() > 0) { ignored.addObjectsFromArray(tmpArray); } } } } } System.out.println("_ignoredPackages:: "+ignored); return ignored; }