@Override public Object clone() { final BwAttachment nobj = new BwAttachment(); copyTo(nobj); return nobj; } }
/** Copy this objects values into the parameter * * @param val to be updated */ public void copyTo(final BwAttachment val) { val.setFmtType(getFmtType()); val.setValueType(getValueType()); val.setEncoding(getEncoding()); val.setUri(getUri()); val.setValue(getValue()); }
/** * @param attProp * @return BwAttachment * @throws Throwable */ public static BwAttachment getAttachment(final Attach attProp) throws Throwable { BwAttachment att = new BwAttachment(); ParameterList pars = attProp.getParameters(); att.setFmtType(getOptStr(pars, "FMTTYPE")); att.setValueType(getOptStr(pars, "VALUE")); att.setEncoding(getOptStr(pars, "ENCODING")); if (att.getEncoding() == null) { att.setUri(attProp.getValue()); } else { att.setValue(attProp.getValue()); } return att; }
@Override public String toString() { final ToString ts = new ToString(this); toStringSegment(ts); ts.append("fmttype", getFmtType()); ts.append("valueType", getValueType()); ts.append("encoding", getEncoding()); if (getUri() != null) { ts.append("uri", getUri()); } else { ts.append("value", getValue()); } return ts.toString(); }
@Override public int compareTo(final BwAttachment that) { if (this == that) { return 0; } int res = CalFacadeUtil.cmpObjval(getEncoding(), that.getEncoding()); if (res != 0) { return res; } res = CalFacadeUtil.cmpObjval(getUri(), that.getUri()); if (res != 0) { return res; } return CalFacadeUtil.cmpObjval(getValue(), that.getValue()); }
/** make an attachment * * @param val * @return Attendee * @throws Throwable */ public static Attach setAttachment(final BwAttachment val) throws Throwable { ParameterList pars = new ParameterList(); String temp = val.getFmtType(); if (temp != null) { pars.add(new FmtType(temp)); } temp = val.getEncoding(); if (temp == null) { return new Attach(pars, val.getUri()); } else { pars.add(new Encoding(temp)); temp = val.getValueType(); if (temp != null) { pars.add(new Value(temp)); } return new Attach(pars, val.getValue()); } }