use of org.eclipse.ecf.core.identity.StringID in project ecf by eclipse.
the class DnsSdNamespace method createInstance.
/* (non-Javadoc)
* @see org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object[])
*/
public ID createInstance(Object[] parameters) throws IDCreateException {
if (parameters != null && parameters.length == 1 && parameters[0] instanceof String) {
String str = (String) parameters[0];
return new DnsSdServiceTypeID(this, str);
} else if (parameters != null && parameters.length == 1 && parameters[0] instanceof IServiceTypeID) {
IServiceTypeID serviceTypeID = (IServiceTypeID) parameters[0];
return new DnsSdServiceTypeID(this, serviceTypeID);
} else if (parameters != null && parameters.length == 1 && parameters[0] instanceof IServiceID) {
IServiceID serviceID = (IServiceID) parameters[0];
return new DnsSdServiceTypeID(this, serviceID.getServiceTypeID());
} else if (parameters != null && parameters.length == 1 && parameters[0] instanceof StringID) {
StringID stringID = (StringID) parameters[0];
return new DnsSdServiceTypeID(this, stringID.getName());
} else if (parameters != null && parameters.length == 2 && parameters[0] instanceof IServiceTypeID && parameters[1] instanceof URI) {
IServiceTypeID serviceTypeID = (IServiceTypeID) parameters[0];
URI uri = (URI) parameters[1];
return new DnsSdServiceID(this, new DnsSdServiceTypeID(this, serviceTypeID), uri);
} else if (parameters != null && parameters.length == 2 && parameters[0] instanceof String && parameters[1] instanceof URI) {
String serviceType = (String) parameters[0];
URI uri = (URI) parameters[1];
return new DnsSdServiceID(this, new DnsSdServiceTypeID(this, serviceType), uri);
} else {
throw new IDCreateException(Messages.DnsSdNamespace_Wrong_Parameters);
}
}
Aggregations