public static String getParamAnnotationType(Function fn, String pName) { String xpName = "{$" + pName + "}"; for (Map.Entry<String, List<List<String>>> ant: fn.getAnnotations().entrySet()) { for (List<String> values: ant.getValue()) { for (String val: values) { //if (pName.equals(val) || xpName.equals(val)) { if (xpName.equals(val)) { return ant.getKey(); } } } } return null; }
private Properties getQueryProperties() { Properties props = new Properties(); List<List<String>> paa = fn.getAnnotations().get(apn_properties); if (paa != null) { for (List<String> properties: paa) { for (String property: properties) { int pos = property.indexOf("="); if (pos > 0) { props.setProperty(property.substring(0, pos), property.substring(pos + 1)); } } } } paa = fn.getAnnotations().get(apn_property); if (paa != null) { for (List<String> properties: paa) { if (properties.size() == 2) { props.setProperty(properties.get(0), properties.get(1)); } } } logger.debug("getQueryProperties; resolved props: {}", props); return props; }
private void setNotFoundParam(Map<String, Object> params, String pType, Parameter pm) { // handle default values List<List<String>> atns = fn.getAnnotations().get(pType); if (atns != null) { String pName = pm.getName(); String xpName = "{$" + pm.getName() + "}"; for (List<String> values: atns) { if (values.size() > 2) { if (pName.equals(values.get(0)) || xpName.equals(values.get(1))) { params.put(pm.getName(), getAtomicValue(pm.getType(), values.get(2))); return; } } } } if (pm.getCardinality().isOptional()) { // pass empty value.. params.put(pm.getName(), null); } }
private void buildMethod(Resource.Builder builder, Module module, Function fn) { logger.debug("buildMethod; got fn: {}", fn.getSignature()); Map<String, List<List<String>>> annotations = fn.getAnnotations(); List<List<String>> values = annotations.get(an_path); if (values != null && values.size() == 1) {
private void buildMethodHandler(Resource.Builder builder, String method, String query, Function fn) { Map<String, List<List<String>>> annotations = fn.getAnnotations(); List<List<String>> consumes = annotations.get(an_consumes); List<List<String>> produces = annotations.get(an_produces);
@Override public void write(ObjectDataOutput out, Function xFunc) throws IOException { out.writeUTF(xFunc.getClassName()); out.writeUTF(xFunc.getMethod()); out.writeObject(xFunc.getResult()); out.writeUTF(xFunc.getDescription()); out.writeUTF(xFunc.getPrefix()); out.writeInt(xFunc.getParameters().size()); for (Parameter xp: xFunc.getParameters()) { out.writeObject(xp); } out.writeInt(xFunc.getAnnotations().size()); for (Map.Entry<String, List<List<String>>> entry: xFunc.getAnnotations().entrySet()) { out.writeUTF(entry.getKey()); out.writeInt(entry.getValue().size()); for (List<String> values: entry.getValue()) { out.writeInt(values.size()); for (String value: values) { out.writeUTF(value); } } } }
Function fn = rm.getFunction(); logger.debug("afterScan; processing function: {}", fn); Map<String, List<List<String>>> annotations = fn.getAnnotations(); List<String> consumes = fn.getFlatAnnotations(an_consumes); List<String> produces = fn.getFlatAnnotations(an_produces);