Copy Constructor useless here?
<p>Consider following situation:</p>

<p>I write a java program for an embedded(modem) device. The SDK doesn't offer Cloneable.
Therefore I have in <code>class GsmSignalStrength</code> the method <code>clone()</code>, but it's not
from <code>Object.clone()</code>, it is "my" implementation.
I would like to know is this useful and correct or should I use a copy constructor in <code>GsmSignalStrength</code>, like in the comment?
I don't see the advantage of a copy constructor, because I will have to create another GsmSignalStrength object in my StateMachine.</p>

<p>Here is my code...</p>

<p>File 1 "Status.java":</p>

<pre><code>class Status
{
    Status(GsmSignalStrength gsmSignalStrength)
    {
        initClass(gsmSignalStrength);
    }

    GsmSignalStrength gsmSignalStrength;

    private void initClass(GsmSignalStrength gsmSignalStrength)
    {
        this.gsmSignalStrength = gsmSignalStrength;
    }
}
</code></pre>

<p>File 2 "GsmSignalStrength":</p>

<pre><code>class GsmSignalStrength
{
    GsmSignalStrength(byte signalStrength)
    {
        initClass(signalStrength);
    }

    GsmSignalStrength()
    {
        initClass(100);
    }

    byte value;

    public void copyTo(GsmSignalStrength destination)
    {
        destination.value = this.value;
    }

    public GsmSignalStrength clone()
    {
        GsmSignalStrength clonedValue = new GsmSignalStrength();

        this.copyTo(clonedValue);

        return clonedValue;
    }

    /* With copy constructor
        GsmSignalStrength(GsmSignalStrength gsmSignalStrength)
        {
            gsmSignalStrength.value = value;
        }
    */

    private void initClass(byte signalStrength)
    {
        this.value = signalStrength;
    }
}
</code></pre>

<p>File 5 "GsmModemHandler":</p>

<pre><code>class GsmModemHandler
{
    GsmModemHandler()
    {
        initClass();
    }

    private GsmSignalStrength m_gsmSignalStrength;

    GsmSignalStrength getGsmSignalStrength()
    {

        ...bla...

        return m_gsmSignalStrength;
    }

    private void initClass()
    {
        m_gsmSignalStrength = new GsmSignalStrength();
    }
}
</code></pre>

<p>File 4 "StateMachine":</p>

<pre><code>class StateMachine
{
    StateMachine(GsmModemHandler gsmModemHandler)
    {
        initClass(gsmModemHandler);
    }

    private GsmModemHandler m_gsmModemHandler;

    void doSomething()
    {
        GsmSignalStrength gsmSignalStrength = m_gsmModemHandler.getGsmSignalStrength();
        Status xy = new Status(gsmSignalStrength.clone());

        /* With copy constructor

            GsmSignalStrength gsmSignalStrengthCopy = new GsmSignalStrength(gsmSignalStrength);
            Status xy = new Status(gsmSignalStrengthCopy);
        */
    }

    private void initClass(GsmModemHandler gsmModemHandler)
    {
        m_gsmModemHandler = gsmModemHandler;
    }
}
</code></pre>
