本文整理汇总了Java中jodd.util.ArraysUtil类的典型用法代码示例。如果您正苦于以下问题:Java ArraysUtil类的具体用法?Java ArraysUtil怎么用?Java ArraysUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArraysUtil类属于jodd.util包,在下文中一共展示了ArraysUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertStringToArray
import jodd.util.ArraysUtil; //导入依赖的package包/类
@Override
protected String[] convertStringToArray(String value) {
String[] strings = StringUtil.splitc(value, NUMBER_DELIMITERS);
int count = 0;
for (int i = 0; i < strings.length; i++) {
strings[count] = strings[i].trim();
if (strings[count].length() == 0) {
continue;
}
if (!strings[count].startsWith(StringPool.HASH)) {
count++;
}
}
if (count != strings.length) {
return ArraysUtil.subarray(strings, 0, count);
}
return strings;
}
示例2: putFile
import jodd.util.ArraysUtil; //导入依赖的package包/类
protected void putFile(String name, UploadFile value) {
if (requestFiles == null) {
requestFiles = new HashMap<>();
}
UploadFile[] fileUploads = requestFiles.get(name);
if (fileUploads != null) {
fileUploads = ArraysUtil.append(fileUploads, value);
} else {
fileUploads = new UploadFile[]{value};
}
requestFiles.put(name, fileUploads);
}
示例3: putParameter
import jodd.util.ArraysUtil; //导入依赖的package包/类
protected void putParameter(String name, String value) {
String[] params = requestParameters.get(name);
if (params != null) {
params = ArraysUtil.append(params, value);
} else {
params = new String[]{value};
}
requestParameters.put(name, params);
}
示例4: putFile
import jodd.util.ArraysUtil; //导入依赖的package包/类
protected void putFile(String name, FileUpload value) {
if (requestFiles == null) {
requestFiles = new HashMap<>();
}
FileUpload[] fileUploads = requestFiles.get(name);
if (fileUploads != null) {
fileUploads = ArraysUtil.append(fileUploads, value);
} else {
fileUploads = new FileUpload[] {value};
}
requestFiles.put(name, fileUploads);
}
示例5: putParameter
import jodd.util.ArraysUtil; //导入依赖的package包/类
protected void putParameter(String name, String value) {
if (requestParameters == null) {
requestParameters = new HashMap<>();
}
String[] params = requestParameters.get(name);
if (params != null) {
params = ArraysUtil.append(params, value);
} else {
params = new String[] {value};
}
requestParameters.put(name, params);
}
示例6: inspectMethods
import jodd.util.ArraysUtil; //导入依赖的package包/类
/**
* Inspects types methods and return map of {@link MethodDescriptor method descriptors}.
*/
protected HashMap<String, MethodDescriptor[]> inspectMethods() {
boolean scanAccessible = classDescriptor.isScanAccessible();
Class type = classDescriptor.getType();
Method[] methods = scanAccessible ? ReflectUtil.getAccessibleMethods(type) : ReflectUtil.getSupportedMethods(type);
HashMap<String, MethodDescriptor[]> map = new HashMap<>(methods.length);
for (Method method : methods) {
String methodName = method.getName();
MethodDescriptor[] mds = map.get(methodName);
if (mds == null) {
mds = new MethodDescriptor[1];
} else {
mds = ArraysUtil.resize(mds, mds.length + 1);
}
map.put(methodName, mds);
mds[mds.length - 1] = createMethodDescriptor(method);
}
return map;
}
示例7: resolveRealName
import jodd.util.ArraysUtil; //导入依赖的package包/类
/**
* Resolves real name from JSON name.
*/
public String resolveRealName(String jsonName) {
if (jsonNames == null) {
return jsonName;
}
int jsonIndex = ArraysUtil.indexOf(jsonNames, jsonName);
if (jsonIndex == -1) {
return jsonName;
}
return realNames[jsonIndex];
}
示例8: resolveJsonName
import jodd.util.ArraysUtil; //导入依赖的package包/类
/**
* Resolves JSON name from real name.
*/
public String resolveJsonName(String realName) {
if (realNames == null) {
return realName;
}
int realIndex = ArraysUtil.indexOf(realNames, realName);
if (realIndex == -1) {
return realName;
}
return jsonNames[realIndex];
}
示例9: excludeTypes
import jodd.util.ArraysUtil; //导入依赖的package包/类
/**
* Excludes type names. You can disable
* serialization of properties that are of some type.
* For example, you can disable properties of <code>InputStream</code>.
* You can use wildcards to describe type names.
*/
public JsonSerializer excludeTypes(String... typeNames) {
if (excludedTypeNames == null) {
excludedTypeNames = typeNames;
} else {
excludedTypeNames = ArraysUtil.join(excludedTypeNames, typeNames);
}
return this;
}
示例10: registerAddonConverter
import jodd.util.ArraysUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void registerAddonConverter(TypeConverter<File> fileTypeConverter) {
if (addonFileConverters == null) {
addonFileConverters = new TypeConverter[0];
}
addonFileConverters = ArraysUtil.append(addonFileConverters, fileTypeConverter);
}
示例11: isTypeSignatureInUse
import jodd.util.ArraysUtil; //导入依赖的package包/类
/**
* Returns <code>true</code> if class contains {@link #getTypeSignatureBytes(Class) type signature}.
* It searches the class content for bytecode signature. This is the fastest way of finding if come
* class uses some type. Please note that if signature exists it still doesn't means that class uses
* it in expected way, therefore, class should be loaded to complete the scan.
*/
protected boolean isTypeSignatureInUse(InputStream inputStream, byte[] bytes) {
try {
byte[] data = StreamUtil.readBytes(inputStream);
int index = ArraysUtil.indexOf(data, bytes);
return index != -1;
} catch (IOException ioex) {
throw new FindFileException("Read error", ioex);
}
}
示例12: not
import jodd.util.ArraysUtil; //导入依赖的package包/类
/**
* Removes elements from the set of matched elements.
*/
public Jerry not(String cssSelector) {
Node[] notNodes = root().find(cssSelector).nodes;
List<Node> result = new NodeList(nodes.length);
for (Node node : nodes) {
if (ArraysUtil.contains(notNodes, node) == false) {
result.add(node);
}
}
return new Jerry(this, result);
}
示例13: checkNotContains
import jodd.util.ArraysUtil; //导入依赖的package包/类
public static void checkNotContains(String[] possibleValues, String value, String msg) {
if (!ArraysUtil.contains(possibleValues, value)) {
throw new IllegalArgumentException(msg);
}
}
示例14: visitEnd
import jodd.util.ArraysUtil; //导入依赖的package包/类
@Override
public void visitEnd() {
if (methodParameters.length > currentParam) {
methodParameters = ArraysUtil.subarray(methodParameters, 0, currentParam);
}
}
示例15: ensureLength
import jodd.util.ArraysUtil; //导入依赖的package包/类
private void ensureLength() {
if (attributesCount + 1 >= attrNames.length) {
attrNames = ArraysUtil.resize(attrNames, attributesCount * 2);
attrValues = ArraysUtil.resize(attrValues, attributesCount * 2);
}
}