peer2me.util
Class ShareObject

java.lang.Object
  extended by peer2me.util.ShareObject

public class ShareObject
extends java.lang.Object

A class that describes a shared object. Current implementation only distinguishes a file from a folder. This class is used in PeerBrowserScreen

Author:
Kim Saxlund
See Also:
peershare.gui.PeerBrowserScreen

Field Summary
static int FILE
           
static int FOLDER
           
 
Constructor Summary
ShareObject(int ID, java.lang.String fileName)
          Creates a new instance of a ShareObject.
ShareObject(java.lang.String dirName)
          Creates a new instance of a ShareObject.
 
Method Summary
 int getID()
          Returns the ID of the object.
 java.lang.String getName()
          Retrieves the objects name
 int getType()
          Returns the type of object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE

public static final int FILE
See Also:
Constant Field Values

FOLDER

public static final int FOLDER
See Also:
Constant Field Values
Constructor Detail

ShareObject

public ShareObject(int ID,
                   java.lang.String fileName)
Creates a new instance of a ShareObject. This constructor should be used when information about a file should be stored.

Parameters:
ID - The unique fileID
fileName - The name of the file

ShareObject

public ShareObject(java.lang.String dirName)
Creates a new instance of a ShareObject. This constructor should be used when information about a folder should be stored.

Parameters:
dirName - The folder name of the directory. This must only be the folder's namem not the path to the folder
Method Detail

getName

public java.lang.String getName()
Retrieves the objects name

Returns:
Name of the file or folder
See Also:
String

getType

public int getType()
Returns the type of object

Returns:
The type can be either FILE or FOLDER

getID

public int getID()
Returns the ID of the object. Only files have ID's, so if the object is a folder, -1 is returned

Returns:
Returns a unique ID or -1