Package net.sourceforge.javautil.common.dsl

Source Code of net.sourceforge.javautil.common.dsl.FileDSL

package net.sourceforge.javautil.common.dsl;

import java.io.File;

import net.sourceforge.javautil.common.io.impl.ISystemArtifact;
import net.sourceforge.javautil.common.io.impl.SystemDirectory;
import net.sourceforge.javautil.common.io.impl.SystemFile;

/**
* DSL methods related to {@link File}'s and related operations.
*
* @author elponderador
* @author $Author: ponderator $
* @version $Id: FileDSL.java 2297 2010-06-16 00:13:14Z ponderator $
*/
public class FileDSL {

  /**
   * @param name The name/path of a file
   * @return A file wrapper object
   */
  public static File toFile (String name) { return new File(name); }
 
  /**
   * @param file The file for which a {@link ISystemArtifact} is desired
   * @return A valid system artifact wrapper
   */
  public static ISystemArtifact toSystem (File file) { return file.isDirectory() ? new SystemDirectory(file) : new SystemFile(file); }
 
}
TOP

Related Classes of net.sourceforge.javautil.common.dsl.FileDSL

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.