/** * Sets an array field on this bean. * * <p> * Works on both <code>Object</code> and primitive arrays. * * @param bean The bean of the field. * @param l The collection to use to set the array field. * @throws IllegalArgumentException Thrown by method invocation. * @throws IllegalAccessException Thrown by method invocation. * @throws InvocationTargetException Thrown by method invocation. */ protected void setArray(Object bean, List l) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { Object array = toArray(l, this.rawTypeMeta.getElementType().getInnerClass()); invokeSetter(bean, name, array); }
/** * Sets an array field on this bean. * * <p> * Works on both <code>Object</code> and primitive arrays. * * @param bean The bean of the field. * @param l The collection to use to set the array field. * @throws IllegalArgumentException Thrown by method invocation. * @throws IllegalAccessException Thrown by method invocation. * @throws InvocationTargetException Thrown by method invocation. */ protected void setArray(Object bean, List l) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { Object array = toArray(l, this.rawTypeMeta.getElementType().getInnerClass()); invokeSetter(bean, name, array); }
/** * Sets an array field on this bean. * * <p> * Works on both <code>Object</code> and primitive arrays. * * @param bean The bean of the field. * @param l The collection to use to set the array field. * @throws IllegalArgumentException Thrown by method invocation. * @throws IllegalAccessException Thrown by method invocation. * @throws InvocationTargetException Thrown by method invocation. */ protected void setArray(Object bean, List l) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { Object array = toArray(l, this.rawTypeMeta.getElementType().getInnerClass()); invokeSetter(bean, name, array); }
for (int i = 0; i < p.length; i++) c.add(parseParameter(p[i], cm.getElementType())); return (T)ArrayUtils.toArray(c, cm.getElementType().getInnerClass()); } else if (cm.isCollection()) { try {
for (int i = 0; i < p.length; i++) c.add(parseParameter(p[i], cm.getElementType())); return (T)ArrayUtils.toArray(c, cm.getElementType().getInnerClass()); } else if (cm.isCollection()) { try {
@SuppressWarnings("rawtypes") private <T> T getAllInner(HttpPartParser parser, HttpPartSchema schema, String name, T def, ClassMeta<T> cm) throws BadRequest, InternalServerError { String[] p = get(name); if (p == null) return def; if (schema == null) schema = HttpPartSchema.DEFAULT; try { if (cm.isArray()) { List c = new ArrayList(); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)toArray(c, cm.getElementType().getInnerClass()); } else if (cm.isCollection()) { Collection c = (Collection)(cm.canCreateNewInstance() ? cm.newInstance() : new ObjectList()); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)c; } } catch (SchemaValidationException e) { throw new BadRequest(e, "Validation failed on query parameter ''{0}''. ", name); } catch (ParseException e) { throw new BadRequest(e, "Could not parse query parameter ''{0}''.", name) ; } catch (Exception e) { throw new InternalServerError(e, "Could not parse query parameter ''{0}''.", name) ; } throw new InternalServerError("Invalid call to getParameters(String, ClassMeta). Class type must be a Collection or array."); }
@SuppressWarnings("rawtypes") private <T> T getAllInner(HttpPartParser parser, HttpPartSchema schema, String name, T def, ClassMeta<T> cm) throws BadRequest, InternalServerError { String[] p = get(name); if (p == null) return def; if (schema == null) schema = HttpPartSchema.DEFAULT; try { if (cm.isArray()) { List c = new ArrayList(); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)toArray(c, cm.getElementType().getInnerClass()); } else if (cm.isCollection()) { Collection c = (Collection)(cm.canCreateNewInstance() ? cm.newInstance() : new ObjectList()); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)c; } } catch (SchemaValidationException e) { throw new BadRequest(e, "Validation failed on query parameter ''{0}''. ", name); } catch (ParseException e) { throw new BadRequest(e, "Could not parse query parameter ''{0}''.", name) ; } catch (Exception e) { throw new InternalServerError(e, "Could not parse query parameter ''{0}''.", name) ; } throw new InternalServerError("Invalid call to getParameters(String, ClassMeta). Class type must be a Collection or array."); }
@SuppressWarnings("rawtypes") <T> T getAllInner(HttpPartParser parser, HttpPartSchema schema, String name, T def, ClassMeta<T> cm) throws BadRequest, InternalServerError { String[] p = get(name); if (p == null) return def; if (schema == null) schema = HttpPartSchema.DEFAULT; try { if (cm.isArray()) { List c = new ArrayList(); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)toArray(c, cm.getElementType().getInnerClass()); } else if (cm.isCollection()) { Collection c = (Collection)(cm.canCreateNewInstance() ? cm.newInstance() : new ObjectList()); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)c; } } catch (SchemaValidationException e) { throw new BadRequest(e, "Validation failed on form-data parameter ''{0}''. ", name); } catch (ParseException e) { throw new BadRequest(e, "Could not parse form-data parameter ''{0}''.", name) ; } catch (Exception e) { throw new InternalServerError(e, "Could not parse form-data parameter ''{0}''.", name) ; } throw new InternalServerError("Invalid call to getParameters(String, ClassMeta). Class type must be a Collection or array."); }
@SuppressWarnings("rawtypes") <T> T getAllInner(HttpPartParser parser, HttpPartSchema schema, String name, T def, ClassMeta<T> cm) throws BadRequest, InternalServerError { String[] p = get(name); if (p == null) return def; if (schema == null) schema = HttpPartSchema.DEFAULT; try { if (cm.isArray()) { List c = new ArrayList(); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)toArray(c, cm.getElementType().getInnerClass()); } else if (cm.isCollection()) { Collection c = (Collection)(cm.canCreateNewInstance() ? cm.newInstance() : new ObjectList()); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)c; } } catch (SchemaValidationException e) { throw new BadRequest(e, "Validation failed on form-data parameter ''{0}''. ", name); } catch (ParseException e) { throw new BadRequest(e, "Could not parse form-data parameter ''{0}''.", name) ; } catch (Exception e) { throw new InternalServerError(e, "Could not parse form-data parameter ''{0}''.", name) ; } throw new InternalServerError("Invalid call to getParameters(String, ClassMeta). Class type must be a Collection or array."); }
@SuppressWarnings("rawtypes") private <T> T getAllInner(HttpPartParser parser, HttpPartSchema schema, String name, T def, ClassMeta<T> cm) throws BadRequest, InternalServerError { String[] p = get(name); if (p == null) return def; if (schema == null) schema = HttpPartSchema.DEFAULT; try { if (cm.isArray()) { List c = new ArrayList(); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)toArray(c, cm.getElementType().getInnerClass()); } else if (cm.isCollection()) { Collection c = (Collection)(cm.canCreateNewInstance() ? cm.newInstance() : new ObjectList()); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)c; } } catch (SchemaValidationException e) { throw new BadRequest(e, "Validation failed on query parameter ''{0}''. ", name); } catch (ParseException e) { throw new BadRequest(e, "Could not parse query parameter ''{0}''.", name) ; } catch (Exception e) { throw new InternalServerError(e, "Could not parse query parameter ''{0}''.", name) ; } throw new InternalServerError("Invalid call to getParameters(String, ClassMeta). Class type must be a Collection or array."); }
@SuppressWarnings("rawtypes") <T> T getAllInner(HttpPartParser parser, HttpPartSchema schema, String name, T def, ClassMeta<T> cm) throws BadRequest, InternalServerError { String[] p = get(name); if (p == null) return def; if (schema == null) schema = HttpPartSchema.DEFAULT; try { if (cm.isArray()) { List c = new ArrayList(); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)toArray(c, cm.getElementType().getInnerClass()); } else if (cm.isCollection()) { Collection c = (Collection)(cm.canCreateNewInstance() ? cm.newInstance() : new ObjectList()); for (int i = 0; i < p.length; i++) c.add(parse(parser, schema.getItems(), p[i], cm.getElementType())); return (T)c; } } catch (SchemaValidationException e) { throw new BadRequest(e, "Validation failed on form-data parameter ''{0}''. ", name); } catch (ParseException e) { throw new BadRequest(e, "Could not parse form-data parameter ''{0}''.", name) ; } catch (Exception e) { throw new InternalServerError(e, "Could not parse form-data parameter ''{0}''.", name) ; } throw new InternalServerError("Invalid call to getParameters(String, ClassMeta). Class type must be a Collection or array."); }
c2.addAll(m.values()); if (sType.isArray()) o = ArrayUtils.toArray(c2, sType.getElementType().getInnerClass()); else if (sType.isArgs()) o = c2.toArray(new Object[c2.size()]);
c2.addAll(m.values()); if (sType.isArray()) o = ArrayUtils.toArray(c2, sType.getElementType().getInnerClass()); else if (sType.isArgs()) o = c2.toArray(new Object[c2.size()]);
c2.addAll(m.values()); if (sType.isArray()) o = ArrayUtils.toArray(c2, sType.getElementType().getInnerClass()); else if (sType.isArgs()) o = c2.toArray(new Object[c2.size()]);