alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.openide.filesystems;

/** Event used to listen on filesystem attribute changes.
*
* @author Petr Hamernik
*/
public class FileAttributeEvent extends FileEvent {
    /** generated Serialized Version UID */
    static final long serialVersionUID = -8601944809928093922L;
    /** Name of attribute. */
    private String name;

    /** Old value of attribute */
    private Object oldValue;

    /** New value of attribute */
    private Object newValue;

    /** Creates new FileAttributeEvent. The FileObject where the action occurred
    * is assumed to be the same as the source object.
    * @param src source file which sent this event
    * @param name name of attribute, or null (since 1.33 only) if any attributes may have changed
    * @param oldValue old value of attribute, or null if the name is
    * @param newValue new value of attribute, or null if the name is
    */
    public FileAttributeEvent(FileObject src, String name, Object oldValue, Object newValue) {
        this(src, src, name, oldValue, newValue);
    }

    /** Creates new FileAttributeEvent.
    * @param src source file which sent this event
    * @param file file object where the action occurred
    * @param name name of attribute, or null (since 1.33 only) if any attributes may have changed
    * @param oldValue old value of attribute, or null if the name is
    * @param newValue new value of attribute, or null if the name is
    */
    public FileAttributeEvent(FileObject src, FileObject file,
                              String name, Object oldValue, Object newValue) {
        this(src, file, name, oldValue, newValue,false);    
    }

    /** Creates new FileAttributeEvent.
    * @param src source file which sent this event
    * @param file file object where the action occurred
    * @param name name of attribute, or null (since 1.33 only) if any attributes may have changed
    * @param oldValue old value of attribute, or null if the name is
    * @param newValue new value of attribute, or null if the name is
    * @param expected sets flag whether the value was expected
    */    
    public FileAttributeEvent(FileObject src, FileObject file,
                              String name, Object oldValue, Object newValue,boolean expected) {
        super(src, file,expected);
        this.name = name;
        this.oldValue = oldValue;
        this.newValue = newValue;
    }
    
    /** Gets the name of the attribute.
    * @return Name of the attribute, or null (since 1.33 only) if an unknown attribute changed
    */
    public String getName () {
        return name;
    }

    /** Gets the old value of the attribute.
    * @return Old value of the attribute, or null if the name is
    */
    public Object getOldValue () {
        return oldValue;
    }

    /** Gets the new value of the attribute.
    * @return New value of the attribute, or null if the name is
    */
    public Object getNewValue () {
        return newValue;
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.