private void addMethodAttributes(Method method, Object returnValue, Map<String, Object> attributes, Map<Integer, String> transformMap) { Annotation[] annotations = method.getDeclaredAnnotations(); for (Annotation annotation : annotations) { if (annotation instanceof Attribute) { addAttribute((Attribute) annotation, returnValue, attributes); } if (annotation instanceof FixedAttribute) { addFixedAttribute((FixedAttribute) annotation, attributes); } if (annotation instanceof FixedAttributes) { addFixedAttributes((FixedAttributes) annotation, attributes); } if (annotation instanceof TransformAttributeMap) { TransformAttributeMap transformAttributeMap = (TransformAttributeMap) annotation; int[] keys = transformAttributeMap.keys(); String[] values = transformAttributeMap.values(); if (keys.length != values.length) { throw new IllegalStateException("TransformAttributeMap keys and values must have same length"); } for (int i = 0; i < keys.length; i++) { transformMap.put(keys[i], values[i]); } } if (annotation instanceof TransformAttribute) { addTransformAttribute((TransformAttribute) annotation, returnValue, transformMap, attributes); } } }