Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBXSerializer #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/main/java/com/jarsj/PBXDocument.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.jarsj;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PBXDocument {

private int archiveVersion;

private List<Element> classes;
private Map<String, Element> classes;

/* XcodeCompatibilityVersion enumeration. */
private int objectVersion;
Expand All @@ -21,7 +19,7 @@ public class PBXDocument {
private PBXProject rootObject;

public PBXDocument() {
this.classes = new ArrayList<Element>();
this.classes = new HashMap<String, Element>();
this.objects = new HashMap<String, Element>();
this.archiveVersion = 1;
this.objectVersion = 46;
Expand All @@ -37,11 +35,11 @@ public void setArchiveVersion(Object archiveVersion) {
}
}

public List<Element> getClasses() {
public Map<String, Element> getClasses() {
return classes;
}

public void setClasses(List<Element> classes) {
public void setClasses(Map<String, Element> classes) {
this.classes = classes;
}

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/jarsj/PBXParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ private void parse() throws Exception {
.get("archiveVersion")));
this.document.setObjectVersion(parseToJavaObject(dict
.get("objectVersion")));
this.document.setClasses(new ArrayList<Element>());
this.document.setClasses(toElementMap(parseToMap((NSDictionary) dict
.get("classes"))));
this.document.setRootObject((PBXProject) parseObject(
(String) parseToJavaObject(dict.get("rootObject")),
(NSDictionary) dict.get("objects")));
Expand Down Expand Up @@ -306,8 +307,7 @@ private XCBuildConfiguration processXCBuildConfiguration(String key,
.get("buildSettings")));
buildConfiguration.setName((String) parseToJavaObject(eleDict
.get("name")));
buildConfiguration.setReference((String) parseToJavaObject(eleDict
.get("reference")));
buildConfiguration.setReference(key);
parsedObjects.put(key, buildConfiguration);
parseInProgressObjects.remove(key);
return buildConfiguration;
Expand Down Expand Up @@ -663,8 +663,7 @@ private List<Object> parseToList(NSArray array) throws Exception {
Object obj = key;
if (((NSDictionary) this.dict.get("objects")).containsKey(key)) {
obj = parseObject(key,
(NSDictionary) this.dict.get("objects"));
;
(NSDictionary) this.dict.get("objects"));
}
outputList.add(obj);
}
Expand Down
Loading