Override the Object's default toString() method

This commit is contained in:
hedgecrw85 2018-07-20 19:25:17 -06:00
parent b550fd73d2
commit 96dc3705c1
1 changed files with 11 additions and 0 deletions

View File

@ -248,6 +248,17 @@ public final class SerialPort
return !canonicalFile.getCanonicalFile().equals(canonicalFile.getAbsoluteFile()); return !canonicalFile.getCanonicalFile().equals(canonicalFile.getAbsoluteFile());
} }
/**
* Returns the same output as calling {@link #getPortDescription()}. This may be useful for display containers which call a Java Object's default toString() method.
*
* @return The port description as reported by the device itself.
*/
@Override
public String toString()
{
return getPortDescription();
}
/** /**
* Returns a list of all available serial ports on this machine. * Returns a list of all available serial ports on this machine.
* <p> * <p>