com.triadsoft.properties.model.utils
Class WildcardPath

java.lang.Object
  extended by com.triadsoft.properties.model.utils.WildcardPath

public class WildcardPath
extends java.lang.Object

Esta clase es la encargada de encapsular todos la logica para poder parsear y descubrir los datos referidos al path La clase no maneja archivos sino que solamente manipula strings y obtiene los datos que serán utilizados por el controlador de archivos

Author:
triad

Field Summary
static java.lang.String COUNTRY_REGEX
           
static java.lang.String COUNTRY_WILDCARD
           
static java.lang.String FILE_EXTENSION_WILDCARD
           
static java.lang.String FILENAME_WILDCARD
           
static java.lang.String LANGUAGE_REGEX
           
static java.lang.String LANGUAGE_WILDCARD
           
static java.lang.String ROOT_WILDCARD
           
static java.lang.String TEXT_REGEX
           
 
Constructor Summary
WildcardPath(java.lang.String wildcardpath)
           
 
Method Summary
 java.lang.String extractPath(java.lang.String filepath)
          Extrae del filepath la parte que coincide con el wilcardpath declarado
 java.lang.String getCountry()
           
 java.lang.String getFileExtension()
           
 java.lang.String getFileName()
           
 java.lang.String getLanguage()
           
 java.util.Locale getLocale()
           
 java.lang.String getLocaleRegex()
          Devuelve la expresion regular necesaria para obtener el locale a partir del nombre del archivo
 java.lang.String getPath()
           
 java.lang.String getPathToRoot()
           
 java.lang.String getRoot()
           
 java.lang.String getWildcardpath()
           
static void main(java.lang.String[] args)
           
 java.lang.Boolean match(java.lang.String filepath)
          This method return true if the file path match with the wildcard path loaded into the WildcardPath object
 java.lang.Boolean parse(java.lang.String filepath)
          Este metodo se encarga de obtener del path pasado como parámetro los datos correspondientes a cada wildcard
 WildcardPath replace(java.util.Locale locale)
          This method replace the language and country into the path string
 WildcardPath replace(java.lang.String wildcard, java.lang.String value)
           
 WildcardPath replace(java.lang.String wildcard, java.lang.String value, boolean replace)
           
 WildcardPath replaceToRegex()
          This method return a wildcard path as regular expresion
 void resetPath()
          Reset the path to initial state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COUNTRY_REGEX

public static final java.lang.String COUNTRY_REGEX
See Also:
Constant Field Values

LANGUAGE_REGEX

public static final java.lang.String LANGUAGE_REGEX
See Also:
Constant Field Values

TEXT_REGEX

public static final java.lang.String TEXT_REGEX
See Also:
Constant Field Values

ROOT_WILDCARD

public static final java.lang.String ROOT_WILDCARD
See Also:
Constant Field Values

FILENAME_WILDCARD

public static final java.lang.String FILENAME_WILDCARD
See Also:
Constant Field Values

FILE_EXTENSION_WILDCARD

public static final java.lang.String FILE_EXTENSION_WILDCARD
See Also:
Constant Field Values

COUNTRY_WILDCARD

public static final java.lang.String COUNTRY_WILDCARD
See Also:
Constant Field Values

LANGUAGE_WILDCARD

public static final java.lang.String LANGUAGE_WILDCARD
See Also:
Constant Field Values
Constructor Detail

WildcardPath

public WildcardPath(java.lang.String wildcardpath)
Method Detail

getWildcardpath

public java.lang.String getWildcardpath()

getPath

public java.lang.String getPath()

getRoot

public java.lang.String getRoot()

getFileName

public java.lang.String getFileName()

getFileExtension

public java.lang.String getFileExtension()

getCountry

public java.lang.String getCountry()

getLanguage

public java.lang.String getLanguage()

getLocale

public java.util.Locale getLocale()

getPathToRoot

public java.lang.String getPathToRoot()

parse

public java.lang.Boolean parse(java.lang.String filepath)
Este metodo se encarga de obtener del path pasado como parámetro los datos correspondientes a cada wildcard


replace

public WildcardPath replace(java.util.Locale locale)
This method replace the language and country into the path string

Parameters:
locale -
Returns:
Devuelve el WilcardPath a la cual reemplazo el pais y el lenguaje

resetPath

public void resetPath()
Reset the path to initial state


replaceToRegex

public WildcardPath replaceToRegex()
This method return a wildcard path as regular expresion


replace

public WildcardPath replace(java.lang.String wildcard,
                            java.lang.String value)

replace

public WildcardPath replace(java.lang.String wildcard,
                            java.lang.String value,
                            boolean replace)

getLocaleRegex

public java.lang.String getLocaleRegex()
Devuelve la expresion regular necesaria para obtener el locale a partir del nombre del archivo

Returns:
String con la expresion regular resultante

match

public java.lang.Boolean match(java.lang.String filepath)
This method return true if the file path match with the wildcard path loaded into the WildcardPath object

Parameters:
filepath - The file path string to compare
Returns:
java.lang.Boolean

extractPath

public java.lang.String extractPath(java.lang.String filepath)
Extrae del filepath la parte que coincide con el wilcardpath declarado

Parameters:
filepath - Path Completo al archivo de recursos
Returns:
String con el la subseccion del filepath

main

public static void main(java.lang.String[] args)