@SuppressWarnings("unchecked") public void registerAddonConverter(TypeConverter<File> fileTypeConverter) { if (addonFileConverters == null) { addonFileConverters = new TypeConverter[0]; } addonFileConverters = ArraysUtil.append(addonFileConverters, fileTypeConverter); }
/** * Adds property injection point. */ protected void addPropertyInjectionPoint(final PropertyInjectionPoint pip) { if (properties == null) { properties = new PropertyInjectionPoint[1]; properties[0] = pip; } else { properties = ArraysUtil.append(properties, pip); } }
/** * Appends single filter to the list of action filters. */ public ActionBuilder filterBy(final Class<? extends ActionFilter> filter) { if (actionFilters == null) { actionFilters = new Class[]{filter}; } else { actionFilters = ArraysUtil.append(actionFilters, filter); } return this; }
/** * Adds method injection point. */ protected void addMethodInjectionPoint(final MethodInjectionPoint mip) { if (methods == null) { methods = new MethodInjectionPoint[1]; methods[0] = mip; } else { methods = ArraysUtil.append(methods, mip); } }
/** * Appends single interceptor to the list of action interceptors. */ public ActionBuilder interceptBy(final Class<? extends ActionInterceptor> interceptor) { if (actionInterceptors == null) { actionInterceptors = new Class[]{interceptor}; } else { actionInterceptors = ArraysUtil.append(actionInterceptors, interceptor); } return this; }
/** * Adds set injection point. */ protected void addSetInjectionPoint(final SetInjectionPoint sip) { if (sets == null) { sets = new SetInjectionPoint[1]; sets[0] = sip; } else { sets = ArraysUtil.append(sets, sip); } }
protected void putParameter(final String name, final 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); }
protected void putFile(final String name, final 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); }
/** * Appends BCC address. * * @param to {@link EmailAddress} to add. * @return this */ public Email bcc(final EmailAddress to) { this.bcc = ArraysUtil.append(this.bcc, to); return _this(); }
/** * Appends REPLY-TO address. * * @param replyTo {@link EmailAddress} to add. * @return this */ public T replyTo(final EmailAddress replyTo) { this.replyTo = ArraysUtil.append(this.replyTo, replyTo); return _this(); }
/** * Appends TO address. * * @param to {@link EmailAddress} to add. * @return this */ public T to(final EmailAddress to) { this.to = ArraysUtil.append(this.to, to); return _this(); }
/** * Appends CC address. * * @param to {@link EmailAddress} to add. * @return this */ public T cc(final EmailAddress to) { this.cc = ArraysUtil.append(this.cc, to); return _this(); }
/** * Adds a new child to the tree. */ public RouteChunk add(final String newValue) { RouteChunk routeChunk = new RouteChunk(routes, this, newValue); if (children == null) { children = new RouteChunk[] {routeChunk}; } else { children = ArraysUtil.append(children, routeChunk); } return routeChunk; }
/** * Binds action annotation and the action config. This can overwrite the default annotation * configuration of an annotation. */ public void bindAnnotationConfig(final Class<? extends Annotation> annotationType, final Class<? extends ActionConfig> actionConfigClass) { final ActionConfig actionConfig = registerNewActionConfiguration(actionConfigClass); actionConfigs.put(annotationType, actionConfig); for (final AnnotationParser annotationParser : annotationParsers) { if (annotationType.equals(annotationParser.getAnnotationType())) { // parser already exists return; } } annotationParsers = ArraysUtil.append(annotationParsers, new AnnotationParser(annotationType, Action.class)); }
@Test void testAppend() { assertArrayEquals(new int[] { 1, 2, 3, 4, 5, 100 }, ArraysUtil.append(x, 100)); assertArrayEquals(new long[] { 1, 2, 3, 4, 5, 100 }, ArraysUtil.values(ArraysUtil.append(xx, Long.valueOf(100)))); assertArrayEquals(new String[] { "f", "o", "o" }, ArraysUtil.append(new String[] { "f", "o" }, "o")); assertArrayEquals(new byte[] { 1, 2, 3 }, ArraysUtil.append(new byte[] { 1, 2 }, (byte) 3)); assertArrayEquals(new char[] { 'f', 'o', 'o' }, ArraysUtil.append(new char[] { 'f', 'o' }, 'o')); assertArrayEquals(new short[] { 1, 2, 3 }, ArraysUtil.append(new short[] { 1, 2 }, (short) 3)); assertArrayEquals(new long[] { 1, 2, 3 }, ArraysUtil.append(new long[] { 1, 2 }, 3l)); assertArrayEquals(new float[] { 1.0f, 2.0f, 3.0f }, ArraysUtil.append(new float[] { 1.0f, 2.0f }, 3.0f), 0.1f); assertArrayEquals(new double[] { 1.0, 2.0, 3.0 }, ArraysUtil.append(new double[] { 1.0, 2.0 }, 3.0), 0.1); assertBooleanArrayEquals(new boolean[] { true, true, false }, ArraysUtil.append(new boolean[] { true, true }, false)); }
Object[] newArray = ArraysUtil.append(array, data[i]);
/** * Appends BCC address. * * @param to {@link EmailAddress} to add. * @return this */ public Email bcc(final EmailAddress to) { this.bcc = ArraysUtil.append(this.bcc, to); return _this(); }