Skip to content

Commit f6bf18f

Browse files
author
Alexander Lippling
committed
Removed delegation methods from Element and added support for boolean, integer, double values in a property list.
Change-Id: If3ce737d8be78d4cc5d629478644b1d5cb4c7e9f
1 parent 67ca483 commit f6bf18f

28 files changed

+520
-216
lines changed

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/Array.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,40 @@
2323

2424
public interface Array extends List<Object>
2525
{
26+
String getString(int index);
27+
28+
void addString(String value);
29+
30+
void setString(int index, String value);
31+
32+
Integer getInteger(int index);
33+
34+
void addInteger(Integer value);
35+
36+
void setInteger(int index, Integer value);
37+
38+
Double getDouble(int index);
39+
40+
void addDouble(Double value);
41+
42+
void setDouble(int index, Double value);
43+
44+
Boolean getBool(int index);
45+
46+
void addBool(Boolean value);
47+
48+
void setBool(int index, Boolean value);
49+
50+
Dict getDict(int index);
51+
52+
void addDict(Dict value);
53+
54+
void setDict(int index, Dict value);
55+
56+
Array getArray(int index);
57+
58+
void addArray(Array value);
59+
60+
void setArray(int index, Array value);
61+
2662
}

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/BuildConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public BuildConfiguration(ProjectFile projectFile)
3333

3434
public BuildSettings getBuildSettings()
3535
{
36-
return new BuildSettings(getProjectFile(), getDict("buildSettings"));
36+
return new BuildSettings(getProjectFile(), getDict().getDict("buildSettings"));
3737
}
3838
}

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/BuildConfigurationList.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ public BuildConfigurationList(ProjectFile projectFile)
3333

3434
public String getDefaultConfigurationName()
3535
{
36-
return getString("defaultConfigurationName");
36+
return getDict().getString("defaultConfigurationName");
3737
}
3838

3939
public ReferenceArray<BuildConfiguration> getBuildConfigurations()
4040
{
4141
return new ReferenceArray<BuildConfiguration>(getProjectFile(),
42-
getOrCreateAndSetArray("buildConfigurations"), new ElementFactory<BuildConfiguration>() {
42+
getDict().getOrCreateAndSetArray("buildConfigurations"), new ElementFactory<BuildConfiguration>() {
4343
@Override
4444
public BuildConfiguration create(ProjectFile projectFile, Dict dict)
4545
{

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/BuildSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public BuildSettings(ProjectFile projectFile)
3333

3434
public String getProductName()
3535
{
36-
return getString("PRODUCT_NAME");
36+
return getDict().getString("PRODUCT_NAME");
3737
}
3838
}

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/Dict.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,33 @@
2121

2222
import java.util.Map;
2323

24-
public interface Dict extends Map<String, Object>, ValueProvider
24+
public interface Dict extends Map<String, Object>
2525
{
26+
String getString(String key);
2627

28+
void setString(String key, String value);
29+
30+
Integer getInteger(String key);
31+
32+
void setInteger(String key, Integer value);
33+
34+
Double getDouble(String key);
35+
36+
void setDouble(String key, Double value);
37+
38+
Boolean getBool(String key);
39+
40+
void setBool(String key, Boolean value);
41+
42+
Array getArray(String key);
43+
44+
Array getOrCreateAndSetArray(String key);
45+
46+
void setArray(String key, Array value);
47+
48+
Dict getDict(String key);
49+
50+
Dict getOrCreateAndSetDict(String key);
51+
52+
void setDict(String key, Dict value);
2753
}

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/Element.java

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
package com.sap.prd.mobile.ios.mios.xcodeprojreader;
2121

22-
public abstract class Element implements ValueProvider
22+
public abstract class Element
2323
{
2424
private final ProjectFile projectFile;
2525
private final Dict dict;
@@ -40,56 +40,8 @@ public Dict getDict()
4040
return dict;
4141
}
4242

43-
@Override
44-
public String getString(String key)
45-
{
46-
return dict.getString(key);
47-
}
48-
49-
@Override
50-
public void setString(String key, String value)
51-
{
52-
dict.setString(key, value);
53-
}
54-
55-
@Override
56-
public Array getArray(String key)
57-
{
58-
return dict.getArray(key);
59-
}
60-
61-
@Override
62-
public Array getOrCreateAndSetArray(String key)
63-
{
64-
return dict.getOrCreateAndSetArray(key);
65-
}
66-
67-
@Override
68-
public void setArray(String key, Array value)
69-
{
70-
dict.setArray(key, value);
71-
}
72-
73-
@Override
74-
public Dict getDict(String key)
75-
{
76-
return dict.getDict(key);
77-
}
78-
79-
@Override
80-
public Dict getOrCreateAndSetDict(String key)
81-
{
82-
return dict.getOrCreateAndSetDict(key);
83-
}
84-
85-
@Override
86-
public void setDict(String key, Dict value)
87-
{
88-
dict.setDict(key, value);
89-
}
90-
9143
public String getIsA()
9244
{
93-
return getString("isa");
45+
return getDict().getString("isa");
9446
}
9547
}

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/NamedElement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ protected NamedElement(ProjectFile projectFile, Dict dict)
2828

2929
public String getName()
3030
{
31-
return getString("name");
31+
return getDict().getString("name");
3232
}
3333

3434
public void setName(String name)
3535
{
36-
setString("name", name);
36+
getDict().setString("name", name);
3737
}
3838
}

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/Project.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ public Project(ProjectFile projectFile)
3333

3434
public String getCompatibilityVersion()
3535
{
36-
return getString("compatibilityVersion");
36+
return getDict().getString("compatibilityVersion");
3737
}
3838

3939
public BuildConfigurationList getBuildConfigurationList()
4040
{
41-
String buildConfigurationListRef = getString("buildConfigurationList");
41+
String buildConfigurationListRef = getDict().getString("buildConfigurationList");
4242
Dict buildConfigurationList = getProjectFile().getObjectByReference(buildConfigurationListRef);
4343
return new BuildConfigurationList(getProjectFile(), buildConfigurationList);
4444
}
4545

4646
public ReferenceArray<Target> getTargets()
4747
{
48-
return new ReferenceArray<Target>(getProjectFile(), getOrCreateAndSetArray("targets"),
48+
return new ReferenceArray<Target>(getProjectFile(), getDict().getOrCreateAndSetArray("targets"),
4949
new ElementFactory<Target>() {
5050
@Override
5151
public Target create(ProjectFile projectFile, Dict dict)

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/ProjectFile.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public String getVersion()
5252

5353
public String getObjectVersion()
5454
{
55-
return getString("objectVersion");
55+
return getDict().getString("objectVersion");
5656
}
5757

5858
public Dict getObjectByReference(String reference)
@@ -85,12 +85,12 @@ public String generateReference()
8585

8686
private Dict getObjects()
8787
{
88-
return getDict("objects");
88+
return getDict().getDict("objects");
8989
}
9090

9191
public Project getProject()
9292
{
93-
String projectRef = getString("rootObject");
93+
String projectRef = getDict().getString("rootObject");
9494
Dict project = getObjectByReference(projectRef);
9595
return new Project(this, project);
9696
}

src/main/java/com/sap/prd/mobile/ios/mios/xcodeprojreader/ReferenceArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public T getByName(String name)
7676
{
7777
for (T object : this)
7878
{
79-
if (name.equals(object.getString("name")))
79+
if (name.equals(object.getDict().getString("name")))
8080
{
8181
return object;
8282
}

0 commit comments

Comments
 (0)