Class JavaPath

  • All Implemented Interfaces:
    IStringValueProvider, IVilType

    public class JavaPath
    extends Path
    Represents a Java path. paths can be converted to Java paths under certain circumstances and v.v.
    Author:
    Holger Eichelberger
    • Field Detail

      • path

        private java.lang.String path
    • Constructor Detail

      • JavaPath

        protected JavaPath​(Path path)
                    throws VilException
        Creates a new java path from a given path.
        Parameters:
        path - the path to create this java path from
        Throws:
        VilException - in case that path cannot be converted
      • JavaPath

        protected JavaPath​(Path path,
                           java.lang.String prefixRegEx)
                    throws VilException
        Creates a new java path from a given path.
        Parameters:
        path - the path to create this java path from
        prefixRegEx - an optional regular expression (intended for prefixes) to be replaced by the empty string (may be null)
        Throws:
        VilException - in case that path cannot be converted
    • Method Detail

      • checkJavaPath

        private static java.lang.String checkJavaPath​(java.lang.String path)
                                               throws VilException
        Checks the given path for compliance to Java path conventions.
        Parameters:
        path - the path to be checked
        Returns:
        path
        Throws:
        VilException - in case that the path does not comply to Java conventions
      • toJavaPath

        public JavaPath toJavaPath()
                            throws VilException
        Description copied from class: Path
        Turns this path into a java package name.
        Overrides:
        toJavaPath in class Path
        Returns:
        the related java Package name
        Throws:
        VilException - in case that the related Java path cannot be created
      • deleteAll

        public void deleteAll()
        Deletes all files in the given path.
        Overrides:
        deleteAll in class Path
      • mkdir

        public void mkdir()
        Creates the directories pointing to path.
        Overrides:
        mkdir in class Path
      • getPath

        public java.lang.String getPath()
        Description copied from class: Path
        Returns the path represented by this instance. This path may be a pattern.
        Overrides:
        getPath in class Path
        Returns:
        the represented path
      • getName

        public java.lang.String getName()
                                 throws VilException
        Description copied from class: Path
        Returns the simple name of this artifact.
        Overrides:
        getName in class Path
        Returns:
        the simple name
        Throws:
        VilException - in case that the operation cannot continue
      • getPathSegments

        public java.lang.String getPathSegments()
        Description copied from class: Path
        Returns the path segments of this path (excluding the names).
        Overrides:
        getPathSegments in class Path
        Returns:
        the path segments
      • getPathSegmentsPath

        public JavaPath getPathSegmentsPath()
        Returns the path segments as Java path.
        Returns:
        the path segments
      • getPackage

        public java.lang.String getPackage()
        Returns the package part of this path.
        Returns:
        the package part
      • convert

        public static JavaPath convert​(java.lang.String val)
        Conversion operation.
        Parameters:
        val - the value to be converted
        Returns:
        the converted value