/** * Optional ArgumentNames. * * <p>This is a fixed length list the same size as getArgumentCount(). */ public List<String> getArgumentNames() { List<String> names = new ArrayList<String>(); for (Parameter<?> arg : args) { names.add(arg.getName()); } return names; }
String.format( "No arguments specified for arg " + "%s, minOccurs = %d", last.getName().toString(), last.getMinOccurs())); String argName = arg.getName().toString(); "Failure converting value for " + "argument %s. %s could not be converted to %s", arg.getName(), obj.toString(), arg.getType().getName()));
/** * Optional ArgumentNames. * <p> * This is a fixed length list the same size as getArgumentCount(). */ public List<String> getArgumentNames() { List<String> names = new ArrayList(); for (Parameter<?> arg : args) { names.add(arg.getName()); } return names; }
void check(Parameter p, String name, Class type, int min, int max) { assertEquals(name, p.getName()); assertEquals(type, p.getType()); assertEquals(min, p.getMinOccurs()); assertEquals(max, p.getMaxOccurs()); } }
/** * Sets the data from a parameter. * * @param parameter the new parameter */ public void setParameter(Parameter<?> parameter) { expressionNodeParameter = parameter; if (parameter != null) { setType(parameter.getType()); setName(parameter.getName()); } }
/** * Validates the structure of arguments, basically enforcing java conventions for variable * level arguments. */ private void validateArguments() throws IllegalArgumentException { List<Parameter<?>> args = getFunctionName().getArguments(); for (int i = 0; i < args.size(); i++) { Parameter<?> arg = args.get(i); if (arg.getMaxOccurs() == 0) { throw new IllegalArgumentException(String.format("Argument %s has zero max")); } if (arg.getMinOccurs() != 1 || arg.getMaxOccurs() != 1) { //this can only happen for the last argument if (i != args.size()-1) { throw new IllegalArgumentException(String.format("Argument %s(%d,%d) invalid." + " Variable arguments must be the last argument of function.", arg.getName(), arg.getMinOccurs(), arg.getMaxOccurs())); } } } }
protected Name lookupTypeName(List<Schema> profiles, Parameter arg) { // hack, look up for geometry mae if ("geometry".equals(arg.getName())) { return new NameImpl(org.geotools.gml3.v3_2.GML.AbstractGeometryType); } // default Class clazz = arg.getType(); if (clazz == null || clazz == Object.class) { return new NameImpl(XS.STRING); } // TODO: this is stolen from FeaturTypeSchemaBuilder, factor out into utility class for (Schema profile : profiles) { for (Map.Entry<Name, AttributeType> e : profile.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(clazz)) { return at.getName(); } } for (AttributeType at : profile.values()) { if (clazz.isAssignableFrom(at.getBinding())) { return at.getName(); } } } return new NameImpl(XS.STRING); } }
/** Sets the function impl. */ private void setFunctionImpl() { FunctionImpl functionExpression = (FunctionImpl) this.expression; FunctionName functionName = functionExpression.getFunctionName(); TypeManager.getInstance().setDataType(functionName.getReturn().getType()); int maxArgument = Math.abs(functionName.getArgumentCount()); for (int index = 0; index < maxArgument; index++) { ExpressionNode childNode = new ExpressionNode(); Parameter<?> parameter = functionName.getArguments().get(0); childNode.setType(parameter.getType()); childNode.setName(parameter.getName()); if (index < functionExpression.getParameters().size()) { childNode.setExpression(functionExpression.getParameters().get(index)); } this.insert(childNode, this.getChildCount()); } }
.get(Math.min(functionName.getArguments().size() - 1, argCount - 1)); childNode.setType(parameter.getType()); childNode.setName(parameter.getName());
Parameter<?> parameter, ProcessFunctionParameterValue value) { if (parameter != null) { value.setName(parameter.getName()); value.setType(parameter.getType()); if (parameter.getType().isEnum()) {