package org.gcube.informationsystem.base.impl.relations; import java.io.StringWriter; import org.gcube.informationsystem.base.impl.ERImpl; import org.gcube.informationsystem.base.reference.entities.E; import org.gcube.informationsystem.base.reference.relations.R; import org.gcube.informationsystem.utils.ISMapper; public abstract class RImpl extends ERImpl implements R { /** * Generated Serial Version UID */ private static final long serialVersionUID = 28704968813390512L; protected Out source; protected In target; protected RImpl() { super(); } protected RImpl(Out source, In target) { this(); this.source = source; this.target = target; } @Override public Out getSource() { return source; } @Override public void setSource(Out source) { this.source = source; } @Override public In getTarget() { return target; } @Override public void setTarget(In target) { this.target = target; } @Override public String toString() { StringWriter stringWriter = new StringWriter(); try { ISMapper.marshal(this, stringWriter); return stringWriter.toString(); } catch (Exception e) { try { ISMapper.marshal(this.header, stringWriter); return stringWriter.toString(); } catch (Exception e1) { return super.toString(); } } } }