public class NamingPolicy extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DESCRIPTION_SEPARATOR
The string used as separator when joining simple descriptions to form a full descritpion.
|
static String |
LIST_SEPARATOR
The string used as separator when joining elements of a list.
|
static String |
NAME_SEPARATOR
The string used as separator when joining simple names to form a full name.
|
Constructor and Description |
---|
NamingPolicy()
Construct a naming policy.
|
Modifier and Type | Method and Description |
---|---|
String[] |
asStringArray(String name)
Return an array of simple names obtained by splitting the input parameter.
|
String |
checkSimpleName(String name,
boolean canModify)
Check the length of a simple name, optionally replace
all illegal characters with underscores,
and convert to lower case.
|
String |
fullDescription(List<String> descriptions)
Return the full description obtained by joining the elements of the argument
with
DESCRIPTION_SEPARATOR . |
String |
fullDescription(String... descriptions)
Return the full description obtained by joining the arguments
with
DESCRIPTION_SEPARATOR . |
String |
fullName(List<String> names)
Return the full name obtained by joining the elements of the argument
with
NAME_SEPARATOR . |
String |
fullName(String... names)
Return the full name obtained by joining the arguments
with
NAME_SEPARATOR . |
protected String |
join(String separator,
String... strings)
Return a string with all the strings starting with the second parameter
joined using the first parameter as the separator.
|
String |
joinValueAndDescription(String value,
String description)
Return a string with the value and the description joined
with
DESCRIPTION_SEPARATOR . |
String[] |
split(String name)
Return an array of length 2 with the parent name and the simple name of the
input argument.
|
String[] |
splitValueAndDescription(String valueAndDescription)
Return an array with a value and a description obtained by splitting the input
on
DESCRIPTION_SEPARATOR . |
public static final String NAME_SEPARATOR
public static final String DESCRIPTION_SEPARATOR
public static final String LIST_SEPARATOR
public String[] split(String name) throws T2DBException
name
- a full nameT2DBException
public String[] asStringArray(String name) throws T2DBException
NAME_SEPARATOR
s.name
- a full nameT2DBException
public String checkSimpleName(String name, boolean canModify) throws T2DBException
name
- a simple namecanModify
- if true replace every illegal character with an underscoreT2DBException
public String fullName(String... names)
NAME_SEPARATOR
.names
- an array of simple namespublic String fullName(List<String> names)
NAME_SEPARATOR
.names
- a list of simple namespublic String fullDescription(String... descriptions)
DESCRIPTION_SEPARATOR
.descriptions
- an array of simple descriptionspublic String fullDescription(List<String> descriptions)
DESCRIPTION_SEPARATOR
.descriptions
- a list of simple descriptionspublic String joinValueAndDescription(String value, String description)
DESCRIPTION_SEPARATOR
.value
- a valuedescription
- a descriptionpublic String[] splitValueAndDescription(String valueAndDescription)
DESCRIPTION_SEPARATOR
.
If there is no description, the second element of the result is an empty string.valueAndDescription
- a string with a value and a descriptionCopyright © 2017. All rights reserved.