org.entityfs.el
Class EntityLocations

java.lang.Object
  extended by org.entityfs.el.EntityLocations

public final class EntityLocations
extends Object

This class contains static utility methods that can come in handy when working with entity locations.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-core

Method Summary
static String convertWindowsSlashes(String path)
          Convert all Windows (back-)slashes to forward slashes.
static String getBaseName(String name)
          Get the base name from the entity name, i.e.
static String getExtensionForName(String name)
          Utility method for getting the extension path of an entity name.
static boolean isEntityNameValid(String name)
          Is the entity name valid?
static EntityLocation<?> parseLocation(String s)
          Parse the supplied location string into an absolute or a relative location.
static void validateEntityName(String name)
          A static utility method for validating an entity name (no EntityLocation.SEPARATOR:s).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getExtensionForName

public static String getExtensionForName(String name)
Utility method for getting the extension path of an entity name. If the name starts with a dot, that dot is ignored.

Parameters:
name - The entity name
Returns:
The name's extension (no dot), or the empty string if the name does not contain any extension.

getBaseName

public static String getBaseName(String name)
Get the base name from the entity name, i.e. The name up to the first extension separator (dot). If the name starts with a dot, that dot is ignored. If the name does not contain any dots, the full name is returned.

Parameters:
name - The name to get the base name for
Returns:
The base name.

isEntityNameValid

public static boolean isEntityNameValid(String name)
Is the entity name valid?

Parameters:
name - The name to test
Returns:
true if the entity name is valid.
Since:
1.1.5

validateEntityName

public static void validateEntityName(String name)
                               throws IllegalArgumentException
A static utility method for validating an entity name (no EntityLocation.SEPARATOR:s).

Parameters:
name - The name to validate.
Throws:
IllegalArgumentException - If the name is not a valid entity name.

convertWindowsSlashes

public static String convertWindowsSlashes(String path)
Convert all Windows (back-)slashes to forward slashes.

Parameters:
path - The string to convert.
Returns:
The converted string.

parseLocation

public static EntityLocation<?> parseLocation(String s)
                                       throws IllegalArgumentException
Parse the supplied location string into an absolute or a relative location.

Parameters:
s - The location string.
Returns:
The location object.
Throws:
IllegalArgumentException - If the location string is not a valid absolute or relative location string.
Since:
1.1