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

Added an inteface HasAttribute which can be used for any class to serial... #48

Merged
merged 1 commit into from Feb 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -2,7 +2,7 @@

import java.util.Vector;

public class AttributeContainer {
public class AttributeContainer implements HasAttributes{
protected Vector attributes = new Vector();

/**
Expand Down
@@ -0,0 +1,12 @@
package org.ksoap2.serialization;

/**
* Common inteface for classes which want to serialize attributes to outgoing soap message
* @author robocik
*/
public interface HasAttributes
{
int getAttributeCount();

void getAttributeInfo(int index, AttributeInfo info);
}
Expand Up @@ -563,8 +563,8 @@ public void writeBody(XmlSerializer writer) throws IOException {
}
}

private void writeAttributes(XmlSerializer writer,AttributeContainer obj) throws IOException {
AttributeContainer soapObject= (AttributeContainer) obj;
private void writeAttributes(XmlSerializer writer,HasAttributes obj) throws IOException {
HasAttributes soapObject= (HasAttributes) obj;
int cnt = soapObject.getAttributeCount();
for (int counter = 0; counter < cnt; counter++) {
AttributeInfo attributeInfo = new AttributeInfo();
Expand All @@ -576,9 +576,9 @@ private void writeAttributes(XmlSerializer writer,AttributeContainer obj) throws

public void writeObjectBodyWithAttributes(XmlSerializer writer, KvmSerializable obj) throws IOException
{
if(obj instanceof AttributeContainer)
if(obj instanceof HasAttributes)
{
writeAttributes(writer, (AttributeContainer) obj);
writeAttributes(writer, (HasAttributes) obj);
}
writeObjectBody(writer, obj);
}
Expand Down