下面列出了org.apache.commons.lang.ArrayUtils#EMPTY_STRING_ARRAY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public String getXml() {
StringBuilder retval = new StringBuilder();
String[] inputTransformsNames = inputTransforms != null ? inputTransforms : ArrayUtils.EMPTY_STRING_ARRAY;
retval.append( " " ).append( XmlHandler.addTagValue( "join_type", getJoinType() ) );
for ( int i = 0; i < inputTransformsNames.length; i++ ) {
retval.append( " " ).append( XmlHandler.addTagValue( "transform" + i, inputTransformsNames[ i ] ) );
}
retval.append( " " ).append( XmlHandler.addTagValue( "number_input", inputTransformsNames.length ) );
retval.append( " " ).append( XmlHandler.openTag( "keys" ) ).append( Const.CR );
for ( int i = 0; i < keyFields.length; i++ ) {
retval.append( " " ).append( XmlHandler.addTagValue( "key", keyFields[ i ] ) );
}
retval.append( " " ).append( XmlHandler.closeTag( "keys" ) ).append( Const.CR );
return retval.toString();
}
/**
* <p>Creates a compact stack trace for the root cause of the supplied
* <code>Throwable</code>.</p>
*
* <p>The output of this method is consistent across JDK versions.
* It consists of the root exception followed by each of its wrapping
* exceptions separated by '[wrapped]'. Note that this is the opposite
* order to the JDK1.4 display.</p>
*
* @param throwable the throwable to examine, may be null
* @return an array of stack trace frames, never null
* @since 2.0
*/
public static String[] getRootCauseStackTrace(Throwable throwable) {
if (throwable == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
Throwable throwables[] = getThrowables(throwable);
int count = throwables.length;
ArrayList frames = new ArrayList();
List nextTrace = getStackFrameList(throwables[count - 1]);
for (int i = count; --i >= 0;) {
List trace = nextTrace;
if (i != 0) {
nextTrace = getStackFrameList(throwables[i - 1]);
removeCommonFrames(trace, nextTrace);
}
if (i == count - 1) {
frames.add(throwables[i].toString());
} else {
frames.add(WRAPPED_MARKER + throwables[i].toString());
}
for (int j = 0; j < trace.size(); j++) {
frames.add(trace.get(j));
}
}
return (String[]) frames.toArray(new String[0]);
}
/**
* 级联操作实体
*
* @param request
* @return
*/
private String[] parseCascades(HttpServletRequest request) {
String cascades = getParameter(request, "cascades");
if (StringUtils.isBlank(cascades)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> casList = new ArrayList<>();
for (String c : cascades.split(",")) {
if (MetadataHelper.containsEntity(c)) {
casList.add(c);
} else {
LOG.warn("Unknow entity in cascades : " + c);
}
}
return casList.toArray(new String[0]);
}
/**
* This method allows to set a custom sql query string; E.g. The original Query does not support
* the usage of INNER JOINS, to use them nevertheless we need to provide a direct method to set
* query strings
*
* @param cl
* the persistent object to set the query for
* @param string
* the SQL query string
* @author Marco Descher
*/
public Query(Class<? extends PersistentObject> cl, final String string){
try {
template = CoreHub.poFactory.createTemplate(cl);
load = cl.getMethod("load", new Class[] {
String.class
});
sql = new StringBuilder(500);
sql.append(string);
ordering = null;
fetchVals = ArrayUtils.EMPTY_STRING_ARRAY;
clearEntityCache = false;
} catch (Exception ex) {
ElexisStatus status =
new ElexisStatus(ElexisStatus.ERROR, CoreHub.PLUGIN_ID, ElexisStatus.CODE_NONE,
"Query: Konnte Methode load auf " + cl.getName() + " nicht auflösen", ex,
ElexisStatus.LOG_ERRORS);
throw new PersistenceException(status);
}
}
private static String[] splitByCharacterType(String str, boolean camelCase) {
if (str == null) {
return null;
} else if (str.length() == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
} else {
char[] c = str.toCharArray();
ArrayList list = new ArrayList();
int tokenStart = 0;
int currentType = Character.getType(c[tokenStart]);
for (int pos = tokenStart + 1; pos < c.length; ++pos) {
int type = Character.getType(c[pos]);
if (type != currentType) {
if (camelCase && type == 2 && currentType == 1) {
int newTokenStart = pos - 1;
if (newTokenStart != tokenStart) {
list.add(new String(c, tokenStart, newTokenStart - tokenStart));
tokenStart = newTokenStart;
}
} else {
list.add(new String(c, tokenStart, pos - tokenStart));
tokenStart = pos;
}
currentType = type;
}
}
list.add(new String(c, tokenStart, c.length - tokenStart));
return ((String[]) list.toArray(new String[list.size()]));
}
}
private String[] extractTextContent(NodeList nodelist) {
String[] result = ArrayUtils.EMPTY_STRING_ARRAY;
for(int i = 0; i < nodelist.getLength(); ++i) {
Element el = (Element)nodelist.item(i);
result = (String[])((String[])ArrayUtils.add(result, el.getTextContent()));
}
return result;
}
/**
* Splits a comma separated value <code>String</code>, trimming leading and trailing whitespace on each value.
* @param str a comma separated <String> with values
* @return an array of <code>String</code> values
*/
public static String[] getTrimmedStrings(String str) {
if (null == str || (str = str.trim()).isEmpty()) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
return str.split("\\s*,\\s*");
}
public String[] getIdpInitSLOReturnToURLs() {
if (idpInitSLOReturnToURLs != null) {
return idpInitSLOReturnToURLs.clone();
} else {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
}
public void getJarFromCP() {
try {
Enumeration resEnum = Thread.currentThread().getContextClassLoader().getResources("META-INF/MANIFEST.MF");
String[] cpElements = ArrayUtils.EMPTY_STRING_ARRAY;
while(resEnum.hasMoreElements()) {
URL url = (URL)resEnum.nextElement();
StringBuilder sb = new StringBuilder("[CP Content] ");
String substringAfterLast = StringUtils.substringAfterLast(StringUtils.substringBefore(url.getPath(), "!"), "/");
if (!"MANIFEST.MF".equals(substringAfterLast)) {
sb.append(substringAfterLast);
cpElements = (String[])((String[])ArrayUtils.add(cpElements, sb.toString()));
}
}
Arrays.sort(cpElements);
String[] arr$ = cpElements;
int len$ = cpElements.length;
for(int i$ = 0; i$ < len$; ++i$) {
String cpElement = arr$[i$];
LOG.debug(cpElement);
}
} catch (IOException var7) {
LOG.error(var7.getMessage(), var7);
}
}
private String[] extractTextContent(NodeList nodelist) {
String[] result = ArrayUtils.EMPTY_STRING_ARRAY;
for(int i = 0; i < nodelist.getLength(); ++i) {
Element el = (Element)nodelist.item(i);
result = (String[])((String[])ArrayUtils.add(result, el.getTextContent()));
}
return result;
}
public void getJarFromCP() {
try {
Enumeration resEnum = Thread.currentThread().getContextClassLoader().getResources("META-INF/MANIFEST.MF");
String[] cpElements = ArrayUtils.EMPTY_STRING_ARRAY;
while(resEnum.hasMoreElements()) {
URL url = (URL)resEnum.nextElement();
StringBuilder sb = new StringBuilder("[CP Content] ");
String substringAfterLast = StringUtils.substringAfterLast(StringUtils.substringBefore(url.getPath(), "!"), "/");
if (!"MANIFEST.MF".equals(substringAfterLast)) {
sb.append(substringAfterLast);
cpElements = (String[])((String[])ArrayUtils.add(cpElements, sb.toString()));
}
}
Arrays.sort(cpElements);
String[] arr$ = cpElements;
int len$ = cpElements.length;
for(int i$ = 0; i$ < len$; ++i$) {
String cpElement = arr$[i$];
LOG.debug(cpElement);
}
} catch (IOException var7) {
LOG.error(var7.getMessage(), var7);
}
}
/**
* @return the requestedRecipients
*/
public String[] getRequestedRecipients() {
if (requestedRecipients != null) {
return requestedRecipients.clone();
} else {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
}
/**
* Cast provided Object to a String[]
*
* @param value Object
* @return String[]
*/
public static String[] getStringArray(Object value) {
if (value != null && value instanceof String[]) {
return (String[]) value;
}
return ArrayUtils.EMPTY_STRING_ARRAY;
}
public String[] listAvailableFunctions() {
try {
return stub.getAllAvailableFunctions();
} catch (RemoteException e) {
LOG.error("Error occured when listing conditional authentication functions.", e);
}
return ArrayUtils.EMPTY_STRING_ARRAY;
}
/**
* Returns a map of module -> alias for each imported module. If a module is imported but not qualified, alias
* will be null.
*/
@NotNull
public static List<Import> parseImports(@NotNull final PsiFile file) {
final boolean noImplicitPrelude = hasPragma(file, "NoImplicitPrelude");
final Import prelude = Import.global("Prelude", false, null);
boolean importedPrelude = false;
HaskellImpdecl[] impdecls = PsiTreeUtil.getChildrenOfType(PsiTreeUtil.getChildOfType(file, HaskellBody.class), HaskellImpdecl.class);
if (impdecls == null) {
if (noImplicitPrelude) return Collections.emptyList();
return Collections.singletonList(prelude);
}
List<Import> result = new ArrayList<Import>(impdecls.length);
for (HaskellImpdecl impdecl : impdecls) {
final List<HaskellQconid> qconids = impdecl.getQconidList();
final int numQconids = qconids.size();
if (numQconids == 0) { continue; }
final HaskellQconid moduleQconid = qconids.get(0);
final String module = moduleQconid.getText();
final String alias = numQconids > 1 ? qconids.get(1).getText() : null;
final boolean isQualified = impdecl.getQualified() != null;
final boolean isHiding = impdecl.getHiding() != null;
final String[] explicitNames;
// Check if we have an empty import list.
if (impdecl.getImpempty() != null) {
explicitNames = ArrayUtils.EMPTY_STRING_ARRAY;
// Otherwise, if we have a left paren, we have an import list.
} else if (impdecl.getLparen() != null) {
explicitNames = getTexts(collectNamedElementsInImporttList(impdecl.getImporttList()));
// At this point, we must not have an import list at all.
} else {
explicitNames = null;
}
importedPrelude = importedPrelude || module.equals("Prelude");
final Import anImport;
if (isQualified) {
if (alias == null) {
anImport = Import.qualified(module, isHiding, explicitNames);
} else {
anImport = Import.qualifiedAs(module, alias, isHiding, explicitNames);
}
} else {
if (alias == null) {
anImport = Import.global(module, isHiding, explicitNames);
} else {
anImport = Import.globalAs(module, alias, isHiding, explicitNames);
}
}
result.add(anImport);
}
if (!importedPrelude && !noImplicitPrelude) { result.add(prelude); }
return result;
}
@Override // FsDatasetSpi
public VolumeFailureSummary getVolumeFailureSummary() {
return new VolumeFailureSummary(ArrayUtils.EMPTY_STRING_ARRAY, 0, 0);
}
public String[] getCascades() {
return cascades == null ? ArrayUtils.EMPTY_STRING_ARRAY : cascades;
}
/**
* <p>Captures the stack trace associated with the specified
* <code>Throwable</code> object, decomposing it into a list of
* stack frames.</p>
*
* <p>The result of this method vary by JDK version as this method
* uses {@link Throwable#printStackTrace(java.io.PrintWriter)}.
* On JDK1.3 and earlier, the cause exception will not be shown
* unless the specified throwable alters printStackTrace.</p>
*
* @param throwable the <code>Throwable</code> to examine, may be null
* @return an array of strings describing each stack frame, never null
*/
public static String[] getStackFrames(Throwable throwable) {
if (throwable == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
return getStackFrames(getStackTrace(throwable));
}
/**
* Converts the given Collection into an array of Strings. The returned array does not contain <code>null</code>
* entries. Note that {@link Arrays#sort(Object[])} will throw an {@link NullPointerException} if an array element
* is <code>null</code>.
*
* @param collection
* The collection to convert
* @return A new array of Strings.
*/
static String[] toNoNullStringArray(Collection collection) {
if (collection == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
return toNoNullStringArray(collection.toArray());
}
/**
* Converts the given Collection into an array of Strings. The returned array does not contain <code>null</code>
* entries. Note that {@link Arrays#sort(Object[])} will throw an {@link NullPointerException} if an array element
* is <code>null</code>.
*
* @param collection
* The collection to convert
* @return A new array of Strings.
*/
static String[] toNoNullStringArray(Collection collection) {
if (collection == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
return toNoNullStringArray(collection.toArray());
}