type:label (ex.
"biocase:permission:scan-request"). In a similar way, the identifier is
represented in the file system. The enableFile flag marks, if the identifier
is allowed to be represented as a File. Otherwise, the
toFile(String)
method returns null.
- Since:
- Version:
- $Revision: 1.13 $
- Author:
- Lutz Suhrbier
logger
private static final Logger logger
iDOMAIN
private static int iDOMAIN
iTYPE
private static int iTYPE
iLABEL
private static int iLABEL
domain
private String domain
- Domain of the identifier
type
private String type
- Type of the identifier
label
private String label
- Label of the identifier
enableFile
private boolean enableFile
- Flag that marks, whether the identifier may be represented in the file
system (
toFile(String)
).
Identifier
public Identifier(String domain,
String type,
String label,
boolean enableFile)
- Creates an Identifier instance.
- Parameters:
domain
- Identifier's domain.type
- Identifier's type.label
- Identifier's label.enableFile
- true
, if the identifier may be represented in
the file system, false
otherwise.
Identifier
protected Identifier()
- Identifiers should be created using
getInstance(URI)
only.
checkParameters
private void checkParameters()
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getInstance
public static Identifier getInstance(URI id)
throws ParsingException
- Creates an Identifier instance based on its URI representation.
- Parameters:
id
- Identifier's URI representation.
- Throws:
ParsingException
- Indicates a malformed identifier representation.
getInstance
public static Identifier getInstance(String id)
throws ParsingException
- Creates an Identifier instance based on its string representation.
- Parameters:
id
- Identifier's URI representation.
- Throws:
ParsingException
- Indicates a malformed identifier representation.
parse
public static String[] parse(String id)
throws ParsingException
- Parses domain, type and label from an Identifier string representation.
- Parameters:
id
- Identifier string representation to parse.
- Returns:
- Array with parsed domain(may be
null
), type and
label.
- Throws:
ParsingException
- Indicates a malformed identifier representation.
parse
public static String[] parse(URI id)
throws ParsingException
- Parses domain, type and label from an Identifier string representation.
- Parameters:
id
- Identifier string representation to parse.
- Returns:
- Array with parsed domain(may be
null
), type and
label.
- Throws:
ParsingException
- Indicates a malformed identifier representation.
setDomain
public void setDomain(String domain)
- Sets the domain.
- Parameters:
domain
- The domain to set.
getDomain
public String getDomain()
- Gets the domain.
- Returns:
- The domain.
setType
protected void setType(String type)
- Sets the type.
- Parameters:
type
- The type to set.
getType
public String getType()
- Gets the type.
- Returns:
- The type.
isEnableFile
public boolean isEnableFile()
- Checks wether the identifier is file enabled.
- Returns:
true
, identifier is file enabled,
false
otherwise.
setLabel
public void setLabel(String label)
- Sets the label.
- Parameters:
label
- The label to set.
getLabel
public String getLabel()
- Gets the label.
- Returns:
- The label.
toURI
public URI toURI()
- Creates the representation of this identifier.
- Returns:
- The identifier's representation.
toString
public String toString()
- Creates the representation of this identifier.
- Returns:
- The identifier's representation.
toFile
public File toFile(String parent)
- Creates a file system representation of this identifier. The
representation is only created, when the identifier is file enabled.
- Parameters:
parent
- Parent directory for the file representation.
- Returns:
- File representation if the identifier is file enabled,
null
otherwise.
toFile
public File toFile(File parent)
- Creates a file system representation of this identifier. The
representation is only created, when the identifier is file enabled.
- Parameters:
parent
- Parent directory for the file representation.
- Returns:
- File representation if the identifier is file enabled,
null
otherwise.
equals
public boolean equals(Object obj)
- Returns true, if the String representations are identical.
- See Also:
Object.equals(java.lang.Object)
hashCode
public int hashCode()
- Returns hash value of the string representation.
- See Also:
Object.hashCode()
Copyright © 2006 Lutz Suhrbier, Freie Universität Berlin. All Rights Reserved.