forked from odata4j/odata4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues found during Android consumer testing.
Update issue 199 Test association with commit
- Loading branch information
1 parent
43ecb73
commit af0755e
Showing
9 changed files
with
182 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ target | |
.settings | ||
.DS_Store | ||
.idea | ||
.externalToolBuilders | ||
*.iml | ||
*.ipr | ||
*.iws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
package org.odata4j.stax2; | ||
|
||
/** | ||
*/ | ||
public interface Namespace2 extends Attribute2 { | ||
|
||
String getNamespaceURI(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
odata4j-core/src/main/java/org/odata4j/stax2/xppimpl/CachedAttribute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.odata4j.stax2.xppimpl; | ||
|
||
import org.core4j.Predicate1; | ||
import org.odata4j.stax2.Attribute2; | ||
import org.odata4j.stax2.QName2; | ||
|
||
public class CachedAttribute implements Attribute2 { | ||
|
||
private final QName2 name; | ||
private final String value; | ||
|
||
public CachedAttribute(QName2 name, String value) { | ||
this.name = name; | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public QName2 getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public String getValue() { | ||
return value; | ||
} | ||
|
||
private static boolean equal(Object lhs, Object rhs) { | ||
return lhs == rhs || (lhs != null && lhs.equals(rhs)); | ||
} | ||
|
||
public static Predicate1<Attribute2> pred1_byQName(final QName2 name) { | ||
return new Predicate1<Attribute2>() { | ||
@Override | ||
public boolean apply(Attribute2 attribute) { | ||
return equal(attribute.getName().getNamespaceUri(),name.getNamespaceUri()) && equal(attribute.getName().getLocalPart(),name.getLocalPart()); | ||
}}; | ||
} | ||
|
||
public static Predicate1<Attribute2> pred1_byName(final String name) { | ||
return new Predicate1<Attribute2>() { | ||
@Override | ||
public boolean apply(Attribute2 attribute) { | ||
return attribute.getName().getLocalPart().equals(name); | ||
}}; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
odata4j-core/src/main/java/org/odata4j/stax2/xppimpl/CachedAttributes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.odata4j.stax2.xppimpl; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.core4j.Enumerable; | ||
import org.odata4j.stax2.Attribute2; | ||
import org.odata4j.stax2.QName2; | ||
|
||
public class CachedAttributes { | ||
|
||
private final List<Attribute2> attributes = new ArrayList<Attribute2>(); | ||
|
||
public Enumerable<Attribute2> getAttributes() { | ||
return Enumerable.create(attributes); | ||
} | ||
|
||
public Attribute2 getAttributeByName(String name) { | ||
return getAttributes().firstOrNull(CachedAttribute.pred1_byName(name)); | ||
} | ||
|
||
public Attribute2 getAttributeByName(QName2 name) { | ||
return getAttributes().firstOrNull(CachedAttribute.pred1_byQName(name)); | ||
} | ||
|
||
public void put(String namespaceUri, String name, String prefix, String value) { | ||
QName2 qname = new QName2(namespaceUri, name, prefix); | ||
Attribute2 attribute = new CachedAttribute(qname, value); | ||
attributes.add(attribute); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters