当前位置: 首页>>代码示例>>Java>>正文


Java ArrayUtils.addAll方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.ArrayUtils.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.addAll方法的具体用法?Java ArrayUtils.addAll怎么用?Java ArrayUtils.addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.ArrayUtils的用法示例。


在下文中一共展示了ArrayUtils.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertWithConstructor

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public static <T> T convertWithConstructor(Row row, Class<T> clazz) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, ParseException {
    Field[] fields = new Field[]{};
    Class temp = clazz;
    while(temp != null){
        fields = ArrayUtils.addAll(temp.getDeclaredFields(), fields);
        temp = temp.getSuperclass();
    }

    Class<?>[] params = new Class[fields.length];
    Object[] paramValues = new Object[fields.length];

    for (Field field : fields) {
        ExcelCellField filedExcelAnnotation = getAnnotationCellFiled(field.getAnnotations());
        if (filedExcelAnnotation == null) {
            continue;
        }
        Integer index = filedExcelAnnotation.index();
        Class<?> fieldType = field.getType();
        params[index] = fieldType;
        paramValues[index] = getValue(fieldType, row.getCell(index), filedExcelAnnotation);
    }
    Constructor<?> constructor = clazz.getDeclaredConstructor(params);
    return (T) constructor.newInstance(paramValues);
}
 
开发者ID:dengxiangjun,项目名称:OfficeAutomation,代码行数:25,代码来源:RowConvert.java

示例2: convertWithMethod

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private static <T> T convertWithMethod(Row row, Class<T> clazz) throws IllegalAccessException, InstantiationException, ParseException, InvocationTargetException {
    Field[] fields = new Field[]{};
    Class temp = clazz;
    while(temp != null){
        fields = ArrayUtils.addAll(temp.getDeclaredFields(),fields);
        temp = temp.getSuperclass();
    }
    Object object = clazz.newInstance();
    for (Field field : fields) {
        ExcelCellField filedExcelAnnotation = getAnnotationCellFiled(field.getAnnotations());
        if (filedExcelAnnotation == null) {
            continue;
        }
        Class<?> fieldType = field.getType();
        Integer index = filedExcelAnnotation.index();
        String propertyName = field.getName();
        Object value = getValue(fieldType, row.getCell(index), filedExcelAnnotation);
        if (value != null) {
            BeanUtils.setProperty(object, propertyName, value);
        }
    }
    return (T) object;
}
 
开发者ID:dengxiangjun,项目名称:OfficeAutomation,代码行数:24,代码来源:RowConvert.java

示例3: dealSinpleEntity

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * 处理单个实体
 *
 * @param entity 实体对象
 * @param list SinpleField的列表
 * @param signField 签名字段
 */
private static void dealSinpleEntity(Object entity, List<FieldPaired> list, Field signField,
    SignatureAlgorithmic algorithmic, String saltParameterPrefix, String charset) {
  Field[] fields = ArrayUtils.addAll(entity.getClass().getSuperclass().getDeclaredFields(),
      entity.getClass().getDeclaredFields());
  for (Field field : fields) {
    if (field.equals(signField)) {
      continue;
    }
    field.setAccessible(true);
    try {
      if (field.isAnnotationPresent(XmlElement.class)) {
        Object value = field.get(entity);
        if (value == null) {
          continue;
        }
        list.add(new FieldPaired(field.getAnnotation(XmlElement.class).name(), value));
      } else if (field.isAnnotationPresent(ApiRequestEntity.class)) {
        Object nextEntity = field.get(entity);
        dealSinpleEntity(nextEntity, list, signField, algorithmic, saltParameterPrefix, charset);
      }
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    }
  }
}
 
开发者ID:minlia-projects,项目名称:minlia-iot,代码行数:33,代码来源:XmlSignatureAnnotationHelper.java

示例4: getSplitAtXY

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public double[][] getSplitAtXY(double x1, double y1, double x2, double y2, double x3, double y3, double x4,
		double y4, Double splitAtX, Double splitAtY) {
	double ax = 3 * (-x1 + 3 * x2 - 3 * x3 + x4);
	double bx = 6 * (x1 - 2 * x2 + x3);
	double cx = 3 * (x2 - x1);
	double ay = 3 * (-y1 + 3 * y2 - 3 * y3 + y4);
	double by = 6 * (y1 - 2 * y2 + y3);
	double cy = 3 * (y2 - y1);
	double[] ts = new double[] {};
	if (splitAtX != null) {
		ts = ArrayUtils.addAll(ts, quadSolve(ax, bx, cx));
	}
	if (splitAtY != null) {
		ts = ArrayUtils.addAll(ts, quadSolve(ay, by, cy));
	}
	Double[] temp = Stream.of(ArrayUtils.toObject(ts)).filter(t -> (t > 0.001 && t < 0.999)).toArray(Double[]::new);
	Arrays.sort(temp, new Comparator<Double>() {
		@Override
		public int compare(Double o1, Double o2) {
			return (int) substraction(o1, o2);
		}
	});
	return splitAtTs(x1, y1, x2, y2, x3, y3, x4, y4, ArrayUtils.toPrimitive(temp));
}
 
开发者ID:icaoweiwei,项目名称:otf2ttf,代码行数:25,代码来源:CTQ.java

示例5: getReferenceBytes

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * Walk along the reference path in the graph and pull out the corresponding bases
 * @param fromVertex    starting vertex
 * @param toVertex      ending vertex
 * @param includeStart  should the starting vertex be included in the path
 * @param includeStop   should the ending vertex be included in the path
 * @return              byte[] array holding the reference bases, this can be null if there are no nodes between the starting and ending vertex (insertions for example)
 */
public byte[] getReferenceBytes( final V fromVertex, final V toVertex, final boolean includeStart, final boolean includeStop ) {
    if( fromVertex == null ) { throw new IllegalArgumentException("Starting vertex in requested path cannot be null."); }
    if( toVertex == null ) { throw  new IllegalArgumentException("From vertex in requested path cannot be null."); }

    byte[] bytes = null;
    V v = fromVertex;
    if( includeStart ) {
        bytes = ArrayUtils.addAll(bytes, getAdditionalSequence(v));
    }
    v = getNextReferenceVertex(v); // advance along the reference path
    while( v != null && !v.equals(toVertex) ) {
        bytes = ArrayUtils.addAll(bytes, getAdditionalSequence(v));
        v = getNextReferenceVertex(v); // advance along the reference path
    }
    if( includeStop && v != null && v.equals(toVertex)) {
        bytes = ArrayUtils.addAll(bytes, getAdditionalSequence(v));
    }
    return bytes;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:28,代码来源:BaseGraph.java

示例6: GameSettings

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public GameSettings()
{
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar));
    this.difficulty = EnumDifficulty.NORMAL;
    this.lastServer = "";
    this.fovSetting = 70.0F;
    this.language = "en_US";
    this.forceUnicodeFont = false;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:GameSettings.java

示例7: GameSettings

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public GameSettings(Minecraft mcIn, File optionsFileIn)
{
    this.setForgeKeybindProperties();
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindFullscreen, this.keyBindSpectatorOutlines, this.keyBindSwapHands}, this.keyBindsHotbar));
    this.difficulty = EnumDifficulty.NORMAL;
    this.lastServer = "";
    this.fovSetting = 70.0F;
    this.language = "en_us";
    this.mc = mcIn;
    this.optionsFile = new File(optionsFileIn, "options.txt");

    if (mcIn.isJava64bit() && Runtime.getRuntime().maxMemory() >= 1000000000L)
    {
        GameSettings.Options.RENDER_DISTANCE.setValueMax(32.0F);
    }
    else
    {
        GameSettings.Options.RENDER_DISTANCE.setValueMax(16.0F);
    }

    this.renderDistanceChunks = mcIn.isJava64bit() ? 12 : 8;
    this.optionsFileOF = new File(optionsFileIn, "optionsof.txt");
    this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
    this.ofKeyBindZoom = new KeyBinding("of.key.zoom", 46, "key.categories.misc");
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.add(this.keyBindings, this.ofKeyBindZoom));
    GameSettings.Options.RENDER_DISTANCE.setValueMax(32.0F);
    this.renderDistanceChunks = 8;
    this.loadOptions();
    Config.initGameSettings(this);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:31,代码来源:GameSettings.java

示例8: executeCommandWithReturn

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * Executes oc command and returns a String
 *
 * @param args command arguments
 * @return Process encapsulating started oc
 */
public String executeCommandWithReturn(final String error, String... args) {
	String[] ocArgs = (String[]) ArrayUtils.addAll(new String[] {ocBinaryPath, "--config=" + CONFIG_FILE.getAbsolutePath()}, args);
	try {
		final Process process = executeLocalCommand(error, false, true, false,
				ocArgs);
		try (final InputStream is = process.getInputStream();
				final StringWriter sw = new StringWriter()) {
			org.apache.commons.io.IOUtils.copy(is, sw);
			return sw.toString();
		}
	} catch (IOException | InterruptedException ex) {
		throw new IllegalArgumentException(error, ex);
	}
}
 
开发者ID:xtf-cz,项目名称:xtf,代码行数:21,代码来源:OpenShiftBinaryClient.java

示例9: GameSettings

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public GameSettings()
{
    this.keyBindings = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar);
    this.difficulty = EnumDifficulty.NORMAL;
    this.lastServer = "";
    this.fovSetting = 70.0F;
    this.language = "en_US";
    this.forceUnicodeFont = false;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:10,代码来源:GameSettings.java

示例10: calculateHash

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * Calculates the hash using relevant fields of this type
 * @return SHA256-hash as raw bytes
 */
public byte[] calculateHash() {
    byte[] hashableData = ArrayUtils.addAll(previousBlockHash, merkleRoot);
    hashableData = ArrayUtils.addAll(hashableData, Longs.toByteArray(tries));
    hashableData = ArrayUtils.addAll(hashableData, Longs.toByteArray(timestamp));
    return DigestUtils.sha256(hashableData);
}
 
开发者ID:neozo-software,项目名称:jblockchain,代码行数:11,代码来源:Block.java

示例11: calculateMerkleRoot

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * Calculates the Hash of all transactions as hash tree.
 * https://en.wikipedia.org/wiki/Merkle_tree
 * @return SHA256-hash as raw bytes
 */
public byte[] calculateMerkleRoot() {
    Queue<byte[]> hashQueue = new LinkedList<>(transactions.stream().map(Transaction::getHash).collect(Collectors.toList()));
    while (hashQueue.size() > 1) {
        // take 2 hashes from queue
        byte[] hashableData = ArrayUtils.addAll(hashQueue.poll(), hashQueue.poll());
        // put new hash at end of queue
        hashQueue.add(DigestUtils.sha256(hashableData));
    }
    return hashQueue.poll();
}
 
开发者ID:neozo-software,项目名称:jblockchain,代码行数:16,代码来源:Block.java

示例12: canonicalStart

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public Contour[] canonicalStart(Contour[] points) {
	int jm = 0;
	for (int j = 1; j < points.length; j++) {
		if (points[j].x < points[jm].x || (points[j].x == points[jm].x && points[j].y < points[jm].y)) {
			jm = j;
		}
	}
	Contour[] result = ArrayUtils.addAll(Arrays.copyOfRange(points, jm, points.length),
			Arrays.copyOfRange(points, 0, jm));
	ArrayUtils.reverse(result);
	return result;
}
 
开发者ID:icaoweiwei,项目名称:otf2ttf,代码行数:13,代码来源:CTQ.java

示例13: awaitedBytes

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private static byte[] awaitedBytes(final byte typeTLV, final short length, final byte[] value, final byte[] bytesBeforeValue) {
    byte[] awaited = ArrayUtils.EMPTY_BYTE_ARRAY;

    // 0 - the less meaning byte (right), 1 most meaning byte (left)
    byte lengthByte0 = (byte) length;
    byte lengthByte1 = (byte) (length >> 8);

    awaited = ArrayUtils.addAll(awaited, (byte) (typeTLV | lengthByte1), lengthByte0);
    awaited = ArrayUtils.addAll(awaited, bytesBeforeValue);
    awaited = ArrayUtils.addAll(awaited, value);
    return awaited;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:LLDPTest.java

示例14: dummyCustomTlv

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private static LLDPTLV dummyCustomTlv(final byte tlvType, final byte[] oui, final byte[] ouiSubtype, final short customLength,
        final byte[] subtypeValue) {
    byte[] fullCustomValue = new byte[0];
    fullCustomValue = ArrayUtils.addAll(fullCustomValue, oui);
    fullCustomValue = ArrayUtils.addAll(fullCustomValue, ouiSubtype);
    fullCustomValue = ArrayUtils.addAll(fullCustomValue, subtypeValue);
    return dummyTlv(tlvType, customLength, fullCustomValue);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:LLDPTest.java

示例15: getTagsForProperty

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public String[] getTagsForProperty(String propertyName) {
	if (propertyName.equals("eventName")) {
		String[] attrEvents = EnumUtils.toNames(AttrEvent.class);
		if (parent != null && parent instanceof UIDynamicElement) {
			String[] eventNames = ((UIDynamicElement)parent).getEventNames();
    		if (eventNames.length > 0) {
    			eventNames = ArrayUtils.add(eventNames, "");
    		}
			return ArrayUtils.addAll(eventNames, attrEvents);
		}
		return attrEvents;
	}
	return new String[0];
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:16,代码来源:UIControlEvent.java


注:本文中的org.apache.commons.lang3.ArrayUtils.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。