|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.perforce.p4java.impl.generic.core.MapEntry
public class MapEntry
Default implementation of the IMapEntry interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.perforce.p4java.core.IMapEntry |
---|
IMapEntry.EntryType |
Field Summary | |
---|---|
protected static Pattern |
elementPattern
|
protected static String |
elementPatternStr
|
protected String |
left
|
protected int |
order
|
protected String |
right
|
protected IMapEntry.EntryType |
type
|
Fields inherited from interface com.perforce.p4java.core.IMapEntry |
---|
EXCLUDE_PREFIX, ORDER_UNKNOWN, OVERLAY_PREFIX |
Constructor Summary | |
---|---|
MapEntry()
Default constructor. |
|
MapEntry(IMapEntry entry)
Copy constructor. |
|
MapEntry(int order,
IMapEntry.EntryType type,
String left,
String right)
Explicit-value constructor. |
|
MapEntry(int order,
String mappingStr)
Attempts to construct a new MapEntry by parsing the passed-in string into type, left, and right components; assumes that the passed-in string is in the format specified by parseViewString (below). |
|
MapEntry(int order,
String left,
String right)
Construct a suitable MapEntry from the passed-in arguments, inferring the entry type from any suitable prefixes on the passed-in left string. |
Method Summary | |
---|---|
String |
getLeft()
Get the "left" entry for this mapping; equivalent to getLeft(false). |
String |
getLeft(boolean quoteBlanks)
Get the "left" entry for this mapping. |
int |
getOrder()
Get the order of this entry in the entry list, if known. |
String |
getRight()
Get the "right" entry for this mapping; equivalent to getRight(false). |
String |
getRight(boolean quoteBlanks)
Get the "right" entry for this mapping. |
IMapEntry.EntryType |
getType()
Return the view map type of this entry. |
static String[] |
parseViewMappingString(String str)
Attempt to parse a string to get left and right view mapping elements out of it along with the optional EntryType spec on any left view strings. |
protected static String |
quoteWhitespaceString(String str)
Put double quotes around file path with whitespace. |
void |
setLeft(String left)
Set the "left" entry for this mapping. |
void |
setOrder(int position)
NOTE: does not affect actual order in the list on its own... |
void |
setRight(String right)
Set the "right" entry for this mapping. |
void |
setType(IMapEntry.EntryType type)
Set this entry's type. |
static String |
stripTypePrefix(String str)
Strip any Perforce entry type prefix from the passed-in string. |
String |
toString()
An alias for this.toString(" ", true). |
String |
toString(String sepString,
boolean quoteBlanks)
Return a canonical String representation of this entry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static String elementPatternStr
protected static Pattern elementPattern
protected int order
protected IMapEntry.EntryType type
protected String left
protected String right
Constructor Detail |
---|
public MapEntry()
public MapEntry(int order, String left, String right)
public MapEntry(int order, IMapEntry.EntryType type, String left, String right)
public MapEntry(int order, String mappingStr)
public MapEntry(IMapEntry entry)
Method Detail |
---|
public int getOrder()
IMapEntry
getOrder
in interface IMapEntry
IMapEntry.getOrder()
public void setOrder(int position)
setOrder
in interface IMapEntry
position
- new orderIMapEntry.setOrder(int)
public IMapEntry.EntryType getType()
IMapEntry
getType
in interface IMapEntry
IMapEntry.getType()
public void setType(IMapEntry.EntryType type)
IMapEntry
setType
in interface IMapEntry
type
- new entry type. May be null.IMapEntry.setType(com.perforce.p4java.core.IMapEntry.EntryType)
public String getLeft()
IMapEntry
getLeft
in interface IMapEntry
IMapEntry.getLeft()
public String getLeft(boolean quoteBlanks)
IMapEntry
getLeft
in interface IMapEntry
quoteBlanks
- if true, and the left string
contains spaces or tabs the entire string is returned
surrounded by quote characters.
IMapEntry.getLeft(boolean)
public void setLeft(String left)
IMapEntry
setLeft
in interface IMapEntry
left
- possibly-null new left mapping entryIMapEntry.setLeft(java.lang.String)
public String getRight()
IMapEntry
getRight
in interface IMapEntry
IMapEntry.getRight()
public String getRight(boolean quoteBlanks)
IMapEntry
getRight
in interface IMapEntry
quoteBlanks
- if true, and the right string
contains spaces or tabs the entire string is returned
surrounded by quote characters.
IMapEntry.getRight(boolean)
public void setRight(String right)
IMapEntry
setRight
in interface IMapEntry
right
- possibly-null new right mapping entryIMapEntry.setRight(java.lang.String)
public String toString(String sepString, boolean quoteBlanks)
IMapEntry
If the passed-in string is null, the left and right strings (if they exist) will be concatenated into one long separator-less string.
If the quoteBlanks parameter is true, if either or both the left or right entries contain spaces, the entries are quoted in full, i.e. the mapping //depot/test/space test 01/... //depot/test/space test 02/... becomes "//depot/test/space test 01/..." "//depot/test/space test 02/...".
toString
in interface IMapEntry
com.perforce.p4java.core.IMapEntry#toString(java.lang.String)
public String toString()
toString
in interface IMapEntry
toString
in class Object
Object.toString()
public static String stripTypePrefix(String str)
public static String[] parseViewMappingString(String str)
The incoming string format is described semi-formally as follows:
[whitespace] leftentry [whitespace rightentry] [whitespace] where leftentry = ([entrytype] non-whitespace-string) | (quote [entrytype] anystring quote) and rightentry = (non-whitespace-string) | (quote anystring quote)Even less formally, if a left or right string has embedded spaces in it, it should be quoted with a double quote character; any left-entry entry type character must be within the quotes if they exist. The quotes are always stripped from the associated element before being returned.
The left string is returned as the first element of the returned array; the right (if it exists) is the second. Either or both can be null, but the array itself will never be null. The left string will still contain any entry type spec prepended (if it exists), and will need further processing to get the entry type (and or remove the entry type character).
if
- not null, string to be parsed; if null, this method returns
an empty (but not null) array
protected static String quoteWhitespaceString(String str)
str
- with whitespace
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |