Class MultiDataObject.Entry

java.lang.Object
org.openide.loaders.MultiDataObject.Entry
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FileEntry, FileEntry.Folder, FileEntry.Numb
Enclosing class:
MultiDataObject

public abstract class MultiDataObject.Entry extends Object implements Serializable
Represents one file in a group data object.
See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Entry(org.openide.filesystems.FileObject file)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.openide.filesystems.FileObject
    copy(org.openide.filesystems.FileObject f, String suffix)
    Called when the entry is to be copied.
    org.openide.filesystems.FileObject
    copyRename(org.openide.filesystems.FileObject f, String name, String ext)
    Called when the entry is to be copied and renamed.
    abstract org.openide.filesystems.FileObject
    createFromTemplate(org.openide.filesystems.FileObject f, String name)
    Called when the entry is to be created from a template.
    abstract void
    Called when the entry is to be deleted.
    boolean
     
    Get the multi data object this entry is assigned to.
    final org.openide.filesystems.FileObject
    Get the file this entry works with.
    int
     
    boolean
    Method that allows to check whether an entry is important or is not.
    boolean
    Tests whether the entry is locked.
    abstract org.openide.filesystems.FileObject
    move(org.openide.filesystems.FileObject f, String suffix)
    Called when the entry is to be moved.
    abstract org.openide.filesystems.FileObject
    rename(String name)
    Called when the entry is to be renamed.
    org.openide.filesystems.FileLock
    Try to lock this file entry.
    protected Object
    Make a Serialization replacement.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Entry

      protected Entry(org.openide.filesystems.FileObject file)
  • Method Details

    • getFile

      public final org.openide.filesystems.FileObject getFile()
      Get the file this entry works with.
    • getDataObject

      public final MultiDataObject getDataObject()
      Get the multi data object this entry is assigned to.
      Returns:
      the data object
    • isImportant

      public boolean isImportant()
      Method that allows to check whether an entry is important or is not. Should be overriden by subclasses, the current implementation returns true.
      Returns:
      true if this entry is important or false if not
    • copy

      public abstract org.openide.filesystems.FileObject copy(org.openide.filesystems.FileObject f, String suffix) throws IOException
      Called when the entry is to be copied. Depending on the entry type, it should either copy the underlying FileObject, or do nothing (if it cannot be copied).
      Parameters:
      f - the folder to create this entry in
      suffix - the suffix to add to the name of original file
      Returns:
      the copied FileObject or null if it cannot be copied
      Throws:
      IOException - when the operation fails
    • rename

      public abstract org.openide.filesystems.FileObject rename(String name) throws IOException
      Called when the entry is to be renamed. Depending on the entry type, it should either rename the underlying FileObject, or delete it (if it cannot be renamed).
      Parameters:
      name - the new name
      Returns:
      the renamed FileObject or null if it has been deleted
      Throws:
      IOException - when the operation fails
    • move

      public abstract org.openide.filesystems.FileObject move(org.openide.filesystems.FileObject f, String suffix) throws IOException
      Called when the entry is to be moved. Depending on the entry type, it should either move the underlying FileObject, or delete it (if it cannot be moved).
      Parameters:
      f - the folder to move this entry to
      suffix - the suffix to use
      Returns:
      the moved FileObject or null if it has been deleted
      Throws:
      IOException - when the operation fails
    • delete

      public abstract void delete() throws IOException
      Called when the entry is to be deleted.
      Throws:
      IOException - when the operation fails
    • createFromTemplate

      public abstract org.openide.filesystems.FileObject createFromTemplate(org.openide.filesystems.FileObject f, String name) throws IOException
      Called when the entry is to be created from a template. Depending on the entry type, it should either copy the underlying FileObject, or do nothing (if it cannot be copied).
      Parameters:
      f - the folder to create this entry in
      name - the new name to use
      Returns:
      the copied FileObject or null if it cannot be copied
      Throws:
      IOException - when the operation fails
    • copyRename

      public org.openide.filesystems.FileObject copyRename(org.openide.filesystems.FileObject f, String name, String ext) throws IOException
      Called when the entry is to be copied and renamed.
      Parameters:
      f - the folder to create this entry in
      name - new file name
      ext - new file extension
      Returns:
      the copied and renamed FileObject, never null
      Throws:
      IOException - when the operation fails
      Since:
      6.3
    • takeLock

      public org.openide.filesystems.FileLock takeLock() throws IOException
      Try to lock this file entry.
      Returns:
      the lock if the operation was successful; otherwise null
      Throws:
      IOException - if the lock could not be taken
    • isLocked

      public boolean isLocked()
      Tests whether the entry is locked.
      Returns:
      true if so
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • writeReplace

      protected Object writeReplace()
      Make a Serialization replacement. The entry is identified by the file object is holds. When serialized, it stores the file object and the data object. On deserialization it finds the data object and creates the right entry for it.