So im trying to figure out how to match two classes in objective-c from my Java code.
The java code is as follows:
import java.io.Serializable;
public interface IClient extends Serializable {
String getDeviceID();
void setDeviceID(String id);
String getNickname();
void setNickname(String name);
boolean matches(IClient client);
}
and the other class is as follows:
import xxx.xxx.xxx.interfaces.IClient;
public class Client implements IClient {
private static final long serialVersionUID = 1L;
private String deviceid;
private String nickname;
public Client() {
deviceid = "";
nickname = "";
}
@Override
public String getDeviceID() {
return this.deviceid;
}
@Override
public void setDeviceID(String id) {
this.deviceid = (id == null) ? "" : id.trim();
}
@Override
public String getNickname() {
return this.nickname;
}
@Override
public void setNickname(String name) {
this.nickname = (name == null) ? "" : name.trim();
}
@Override
public boolean matches(IClient client) {
if (client != null) {
if (client == this) {
return true;
}
if (client.getDeviceID().equals(deviceid) && client.getNickname().equals(nickname)) {
return true;
}
}
return false;
}
}
So I dont quite get how you would go about to convert the boolean, the code is on Objective-c atm is that IClient i a protocol and Client inherits it as follows:
Client.h
#import <Foundations/Foundation.h>
@protocol IClient <NSObject>
-(NSString*) DeviceID;
-(NSString*) Nickname;
-(BOOL) matches; // dont really know how to do that one
@end
IClient.h
#import <Foundations/Foundation.h>
#import "IClient.h"
@interface Client : NSObject <IClient>
//etc..
@end
Any help is welcome.