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 java.lang.Object
implements org.fuin.utils4j.ToDebugStringCapable

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


Constructor Summary
SrcDir(java.lang.String path, java.lang.String srcPathUrl)
          Constructor with all arguments.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 java.lang.String getCanonicalPathAndFilename(java.io.File baseDir, java.lang.String filename)
          Returns the absolute file based on a given base directory as String.
 java.io.File getDestFile(java.io.File baseDir, java.lang.String filename)
          Returns the absolute file based on a given base directory.
 java.lang.String getPath()
          Returns the path of the file.
 java.lang.String getRelativeSlashPathAndFilename(java.lang.String filename)
          Returns a relative path and filename.
 java.lang.String getSlashPath()
          Returns the path with a slash ("/") used as path separator.
 java.net.URL getSrcFileURL(java.lang.String filename)
          Returns the URL where the source file is located.
 java.lang.String getSrcPathUrl()
          Returns the URL where the source directory is located.
 int hashCode()
          
 java.lang.String toDebugString()
          
 java.lang.String toString()
          
 java.lang.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(java.lang.String path,
              java.lang.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 java.lang.String getPath()
Returns the path of the file.

Returns:
Path relative to the base directory.

getSrcPathUrl

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

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

getSrcFileURL

public final java.net.URL getSrcFileURL(java.lang.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 java.lang.String getCanonicalPathAndFilename(java.io.File baseDir,
                                                          java.lang.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 java.lang.String getRelativeSlashPathAndFilename(java.lang.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 java.lang.String getSlashPath()
Returns the path with a slash ("/") used as path separator.

Returns:
Path.

getDestFile

public final java.io.File getDestFile(java.io.File baseDir,
                                      java.lang.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 java.lang.String toXML()
Creates an XML representation of the object.

Returns:
XML for element "dir"

hashCode

public final int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public final boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

toDebugString

public final java.lang.String toDebugString()

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

toString

public final java.lang.String toString()

Overrides:
toString in class java.lang.Object


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