org.fuin.kickstart4j
Class SrcDir

java.lang.Object
  extended by org.fuin.kickstart4j.SrcDir
All Implemented Interfaces:
org.fuin.utils4j.ToDebugStringCapable

public final class SrcDir
extends Object
implements org.fuin.utils4j.ToDebugStringCapable

A directory inside a base directory. This class is immutable.


Constructor Summary
SrcDir(String path, String srcPathUrl)
          Constructor with all arguments.
 
Method Summary
 boolean equals(Object obj)
          
 String getCanonicalPathAndFilename(File baseDir, String filename)
          Returns the absolute file based on a given base directory as String.
 File getDestFile(File baseDir, String filename)
          Returns the absolute file based on a given base directory.
 String getPath()
          Returns the path of the file.
 String getRelativeSlashPathAndFilename(String filename)
          Returns a relative path and filename.
 String getSlashPath()
          Returns the path with a slash ("/") used as path separator.
 URL getSrcFileURL(String filename)
          Returns the URL where the source file is located.
 String getSrcPathUrl()
          Returns the URL where the source directory is located.
 int hashCode()
          
 String toDebugString()
          
 String toString()
          
 String toXML()
          Creates an XML representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SrcDir

public SrcDir(String path,
              String srcPathUrl)
Constructor with all arguments.

Parameters:
path - Path relative to the base directory.
srcPathUrl - URL where the source directory is located - Contains the variable ${filename}.
Method Detail

getPath

public final String getPath()
Returns the path of the file.

Returns:
Path relative to the base directory.

getSrcPathUrl

public final String getSrcPathUrl()
Returns the URL where the source directory is located.

Returns:
URL (as String) - Contains the variable: ${filename}.

getSrcFileURL

public final URL getSrcFileURL(String filename)
Returns the URL where the source file is located. A MalformedURLException is wrapped into a RuntimeException.

Parameters:
filename - Name of the file to return a URL for.
Returns:
URL (without Variables).

getCanonicalPathAndFilename

public final String getCanonicalPathAndFilename(File baseDir,
                                                String filename)
Returns the absolute file based on a given base directory as String.

Parameters:
baseDir - Base directory.
filename - Name of a file inside the directory.
Returns:
File path and name inside the base directory.

getRelativeSlashPathAndFilename

public final String getRelativeSlashPathAndFilename(String filename)
Returns a relative path and filename. A slash ("/") is used as path separator.

Parameters:
filename - Name of a file inside the directory.
Returns:
Path and filename.

getSlashPath

public final String getSlashPath()
Returns the path with a slash ("/") used as path separator.

Returns:
Path.

getDestFile

public final File getDestFile(File baseDir,
                              String filename)
Returns the absolute file based on a given base directory.

Parameters:
baseDir - Base directory.
filename - Name of a file inside the directory.
Returns:
File inside the base directory.

toXML

public final String toXML()
Creates an XML representation of the object.

Returns:
XML for element "dir"

hashCode

public final int hashCode()

Overrides:
hashCode in class Object

equals

public final boolean equals(Object obj)

Overrides:
equals in class Object

toDebugString

public final String toDebugString()

Specified by:
toDebugString in interface org.fuin.utils4j.ToDebugStringCapable

toString

public final String toString()

Overrides:
toString in class Object


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.