|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.iapi.util
Class IdUtil

java.lang.Objectorg.apache.derby.iapi.util.IdUtil
- public abstract class IdUtil
- extends java.lang.Object
Utility class for parsing and producing string representations of ids. This class supports both delimited and un-delimited ids.
The syntax for an id follows.
id := delim-id | unDelim-id
delim-id := "[""|[any char but quote]]+"
undelim-id := (a-z|A-Z|anyunicodeletter)[a-z|A-Z|_|0-9|anyunicodeletter|anyunicodedigit]*
In the syntax braces show grouping. '*' means repeat 0 or more times.
'|' means or. '+' means repeat 1 or more times.
In addition this class provides support for qualified names. A qualified name is a dot (.) separated list of ids.
Limitations:
- Unicode escape sequences in ids are not supported.
- Escape sequences (\n...) are not supported.
| Field Summary | |
static int |
DBCP_SCHEMA_NAME
Index of the schema name in a jar name on a db classpath |
static int |
DBCP_SQL_JAR_NAME
Index of the sql jar name in a jar name on a db classpath |
| Constructor Summary | |
IdUtil()
|
|
| Method Summary | |
static java.lang.String |
appendId(java.lang.String id,
java.lang.String list)
Append an id in external form. |
static java.lang.String |
deleteId(java.lang.String id,
java.lang.String list)
Delete an id from a list of ids. |
static java.lang.String |
delimitId(java.lang.String id)
Delimit the identifier provided. |
static java.lang.String |
dups(java.lang.String[] l)
Return an IdList with all the ids that are repeated in l. |
private static boolean |
idChar(boolean first,
int c)
|
static boolean |
idOnList(java.lang.String id,
java.lang.String list)
Return true if the id provided is on the list provided. |
static java.lang.String |
intersect(java.lang.String[] l1,
java.lang.String[] l2)
Return an IdList with all the ids that in l1 and l2 or null if not ids are on both lists. |
static java.lang.String |
mkIdList(java.lang.String[] ids)
Produce a string form of an idList from an array of normalized ids. |
private static java.lang.String |
mkIdListAsEntered(java.lang.String[] externalIds)
Produce an id list from an array of ids in external form |
static java.lang.String |
mkQualifiedName(java.lang.String[] ids)
Make a string form of a qualified name from the array of ids provided. |
static java.lang.String |
mkQualifiedName(java.lang.String id1,
java.lang.String id2)
Produce a delimited two part qualified name from two un-delimited identifiers. |
static java.lang.String[][] |
parseDbClassPath(java.lang.String input,
boolean normalizeToUpper)
Scan a database classpath from the string provided. |
static java.lang.String |
parseId(java.lang.String s)
Convert the String provided to an ID. |
static java.lang.String |
parseId(java.io.StringReader r,
boolean normalize,
boolean normalizeToUpper)
Read an id from the StringReader provided. |
static java.lang.String[] |
parseIdList(java.lang.String p)
Scan a list of ids from the string provided. |
private static java.lang.String[] |
parseIdList(java.io.StringReader r,
boolean normalize)
Parse an idList. |
private static java.lang.String |
parseQId(java.io.StringReader r,
boolean normalize)
|
static java.lang.String[] |
parseQualifiedName(java.lang.String s,
boolean normalizeToUpper)
Scan a qualified name from the String provided. |
static java.lang.String[] |
parseQualifiedName(java.io.StringReader r,
boolean normalizeToUpper)
Scan a qualified name from a StringReader. |
private static java.lang.String |
parseUnQId(java.io.StringReader r,
boolean normalize,
boolean normalizeToUpper)
|
static java.lang.String |
pruneDups(java.lang.String l)
Return an IdList with all the duplicate ids removed |
private static java.lang.String |
vectorToIdList(java.util.Vector v,
boolean normal)
Return an idList in external form with one id for every element of v. |
private static void |
verifyEmpty(java.io.Reader r)
|
private static void |
verifyListEmpty(java.io.StringReader r)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
DBCP_SCHEMA_NAME
public static final int DBCP_SCHEMA_NAME
- Index of the schema name in a jar name on a db classpath
- See Also:
- Constant Field Values
DBCP_SQL_JAR_NAME
public static final int DBCP_SQL_JAR_NAME
- Index of the sql jar name in a jar name on a db classpath
- See Also:
- Constant Field Values
| Constructor Detail |
IdUtil
public IdUtil()
| Method Detail |
delimitId
public static java.lang.String delimitId(java.lang.String id)
- Delimit the identifier provided.
mkQualifiedName
public static java.lang.String mkQualifiedName(java.lang.String id1, java.lang.String id2)
- Produce a delimited two part qualified name from two
un-delimited identifiers.
mkQualifiedName
public static java.lang.String mkQualifiedName(java.lang.String[] ids)
- Make a string form of a qualified name from the array of ids provided.
parseQualifiedName
public static java.lang.String[] parseQualifiedName(java.lang.String s, boolean normalizeToUpper) throws org.apache.derby.iapi.error.StandardException
- Scan a qualified name from the String provided. Raise an excepion
if the string does not contain a qualified name.
parseQualifiedName
public static java.lang.String[] parseQualifiedName(java.io.StringReader r, boolean normalizeToUpper) throws org.apache.derby.iapi.error.StandardException
- Scan a qualified name from a StringReader. Return an array
of Strings with 1 entry per name scanned. Raise an exception
if the StringReader does not contain a valid qualified name.
parseId
public static java.lang.String parseId(java.lang.String s) throws org.apache.derby.iapi.error.StandardException
- Convert the String provided to an ID. Throw an exception
iff the string does not contain only a valid external form
for an id. This is a convenience routine that simply
uses getId(StringReader) to do the work.
See the header for getId below for restrictions.
parseId
public static java.lang.String parseId(java.io.StringReader r, boolean normalize, boolean normalizeToUpper) throws org.apache.derby.iapi.error.StandardException
- Read an id from the StringReader provided.
parseUnQId
private static java.lang.String parseUnQId(java.io.StringReader r, boolean normalize, boolean normalizeToUpper) throws java.io.IOException, org.apache.derby.iapi.error.StandardException
idChar
private static boolean idChar(boolean first,
int c)
parseQId
private static java.lang.String parseQId(java.io.StringReader r, boolean normalize) throws java.io.IOException, org.apache.derby.iapi.error.StandardException
verifyEmpty
private static void verifyEmpty(java.io.Reader r) throws org.apache.derby.iapi.error.StandardException
parseDbClassPath
public static java.lang.String[][] parseDbClassPath(java.lang.String input, boolean normalizeToUpper) throws org.apache.derby.iapi.error.StandardException
- Scan a database classpath from the string provided. This returns
an array with one qualified name per entry on the classpath. The
constants above describe the content of the returned names. This
raises an an exception if the string does not contain a valid database
class path.
classpath := item[:item]* item := id.id In the syntax braces ([]) show grouping. '*' means repeat 0 or more times. The syntax for id is defined in IdUtil.
Classpath returned is a two part name.
If the class path is empty then this returns an array of zero length.
parseIdList
public static java.lang.String[] parseIdList(java.lang.String p) throws org.apache.derby.iapi.error.StandardException
- Scan a list of ids from the string provided. This returns
an array with id per entry. This raises an an exception if
the string does not contain a valid list of names.
parseIdList
private static java.lang.String[] parseIdList(java.io.StringReader r, boolean normalize) throws org.apache.derby.iapi.error.StandardException
- Parse an idList.
intersect
public static java.lang.String intersect(java.lang.String[] l1, java.lang.String[] l2)
- Return an IdList with all the ids that in l1 and l2
or null if not ids are on both lists.
vectorToIdList
private static java.lang.String vectorToIdList(java.util.Vector v, boolean normal)
- Return an idList in external form with one id for every
element of v. If v has no elements, return null.
dups
public static java.lang.String dups(java.lang.String[] l)
- Return an IdList with all the ids that are repeated
in l.
pruneDups
public static java.lang.String pruneDups(java.lang.String l) throws org.apache.derby.iapi.error.StandardException
- Return an IdList with all the duplicate ids removed
mkIdList
public static java.lang.String mkIdList(java.lang.String[] ids)
- Produce a string form of an idList from an array of
normalized ids.
mkIdListAsEntered
private static java.lang.String mkIdListAsEntered(java.lang.String[] externalIds)
- Produce an id list from an array of ids in external form
verifyListEmpty
private static void verifyListEmpty(java.io.StringReader r) throws org.apache.derby.iapi.error.StandardException
idOnList
public static boolean idOnList(java.lang.String id, java.lang.String list) throws org.apache.derby.iapi.error.StandardException
- Return true if the id provided is on the list provided.
deleteId
public static java.lang.String deleteId(java.lang.String id, java.lang.String list) throws org.apache.derby.iapi.error.StandardException
- Delete an id from a list of ids.
appendId
public static java.lang.String appendId(java.lang.String id, java.lang.String list) throws org.apache.derby.iapi.error.StandardException
- Append an id in external form.
|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.iapi.util.IdUtil