Example usage for java.lang.reflect Modifier STATIC

List of usage examples for java.lang.reflect Modifier STATIC

Introduction

In this page you can find the example usage for java.lang.reflect Modifier STATIC.

Prototype

int STATIC

To view the source code for java.lang.reflect Modifier STATIC.

Click Source Link

Document

The int value representing the static modifier.

Usage

From source file:org.apache.xml.security.utils.CachedXPathFuncHereAPI.java

private static void fixupFunctionTable() {
    boolean installed = false;
    if (log.isDebugEnabled()) {
        log.debug("Registering Here function");
    }/*from   w w w  . j  a  v a2 s. co  m*/
    /**
     * Try to register our here() implementation as internal function.
     */
    try {
        Class[] args = { String.class, Expression.class };
        Method installFunction = FunctionTable.class.getMethod("installFunction", args);
        if ((installFunction.getModifiers() & Modifier.STATIC) != 0) {
            Object[] params = { "here", new FuncHere() };
            installFunction.invoke(null, params);
            installed = true;
        }
    } catch (Throwable t) {
        log.debug("Error installing function using the static installFunction method", t);
    }
    if (!installed) {
        try {
            funcTable = new FunctionTable();
            Class[] args = { String.class, Class.class };
            Method installFunction = FunctionTable.class.getMethod("installFunction", args);
            Object[] params = { "here", FuncHere.class };
            installFunction.invoke(funcTable, params);
            installed = true;
        } catch (Throwable t) {
            log.debug("Error installing function using the static installFunction method", t);
        }
    }
    if (log.isDebugEnabled()) {
        if (installed) {
            log.debug("Registered class " + FuncHere.class.getName()
                    + " for XPath function 'here()' function in internal table");
        } else {
            log.debug("Unable to register class " + FuncHere.class.getName()
                    + " for XPath function 'here()' function in internal table");
        }
    }
}

From source file:com.link_intersystems.lang.reflect.criteria.MemberCriteriaTest.java

@Test
public void privateStaticFields() {
    memberCriteria.membersOfType(Field.class);
    memberCriteria.withAccess(AccessType.PRIVATE);
    memberCriteria.withModifiers(Modifier.STATIC);
    ClassCriteria classCriteria = new ClassCriteria();
    Iterable<Class<?>> classIterable = classCriteria.getIterable(Class.class);
    Iterable<Member> memberIterable = memberCriteria.getIterable(classIterable);
    assertTrue(memberIterable.iterator().hasNext());
    for (Member member : memberIterable) {
        assertTrue("member must be a field", member instanceof Field);
        int modifiers = member.getModifiers();
        assertFalse(Modifier.isPublic(modifiers));
        assertFalse(Modifier.isProtected(modifiers));
        assertTrue(Modifier.isPrivate(modifiers));
        assertTrue(Modifier.isStatic(modifiers));
    }// w  ww .j a v a  2s. co m
}

From source file:org.gvnix.addon.jpa.addon.audit.providers.envers.EnversRevisionLogMetadataBuilder.java

/**
 * @return gets or creates getProperty(name) method
 *//*from  w ww. j a  v  a2  s  . co  m*/
private MethodMetadata getPropertyMethod() {
    // Define method parameter types
    List<AnnotatedJavaType> parameterTypes = helper.toAnnotedJavaType(JavaType.STRING);

    // Check if a method exist in type
    final MethodMetadata method = helper.methodExists(GET_PROPERTY_METHOD, parameterTypes);
    if (method != null) {
        // If it already exists, just return the method
        return method;
    }

    // Define method annotations (none in this case)
    List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();

    // Define method throws types (none in this case)
    List<JavaType> throwsTypes = new ArrayList<JavaType>();

    // Define method parameter names (none in this case)
    List<JavaSymbolName> parameterNames = helper.toSymbolName("name");

    // Create the method body
    InvocableMemberBodyBuilder body = new InvocableMemberBodyBuilder();
    // return getProperty(name, new BeanWrapperImpl(Visit.class));
    body.appendFormalLine(String.format("return %s(name, new %s(%s.class));", GET_PROPERTY_METHOD,
            helper.getFinalTypeName(BEAN_WRAPPER_IMPL), StringUtils.capitalize(context.getEntityName())));

    // Use the MethodMetadataBuilder for easy creation of MethodMetadata
    MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(context.getMetadataId(),
            Modifier.PUBLIC + Modifier.STATIC, GET_PROPERTY_METHOD, AUDIT_PROPERTY_GENERIC, parameterTypes,
            parameterNames, body);
    methodBuilder.setAnnotations(annotations);
    methodBuilder.setThrowsTypes(throwsTypes);

    return methodBuilder.build(); // Build and return a MethodMetadata
}

From source file:net.minecraftforge.common.util.EnumHelper.java

@SuppressWarnings({ "unchecked", "serial" })
@Nullable//from  w w w . jav  a 2 s.  c  o  m
private static <T extends Enum<?>> T addEnum(boolean test, final Class<T> enumType, @Nullable String enumName,
        final Class<?>[] paramTypes, @Nullable Object[] paramValues) {
    if (!isSetup) {
        setup();
    }

    Field valuesField = null;
    Field[] fields = enumType.getDeclaredFields();

    for (Field field : fields) {
        String name = field.getName();
        if (name.equals("$VALUES") || name.equals("ENUM$VALUES")) //Added 'ENUM$VALUES' because Eclipse's internal compiler doesn't follow standards
        {
            valuesField = field;
            break;
        }
    }

    int flags = (FMLForgePlugin.RUNTIME_DEOBF ? Modifier.PUBLIC : Modifier.PRIVATE) | Modifier.STATIC
            | Modifier.FINAL | 0x1000 /*SYNTHETIC*/;
    if (valuesField == null) {
        String valueType = String.format("[L%s;", enumType.getName().replace('.', '/'));

        for (Field field : fields) {
            if ((field.getModifiers() & flags) == flags
                    && field.getType().getName().replace('.', '/').equals(valueType)) //Apparently some JVMs return .'s and some don't..
            {
                valuesField = field;
                break;
            }
        }
    }

    if (valuesField == null) {
        final List<String> lines = Lists.newArrayList();
        lines.add(String.format("Could not find $VALUES field for enum: %s", enumType.getName()));
        lines.add(String.format("Runtime Deobf: %s", FMLForgePlugin.RUNTIME_DEOBF));
        lines.add(String.format("Flags: %s",
                String.format("%16s", Integer.toBinaryString(flags)).replace(' ', '0')));
        lines.add("Fields:");
        for (Field field : fields) {
            String mods = String.format("%16s", Integer.toBinaryString(field.getModifiers())).replace(' ', '0');
            lines.add(String.format("       %s %s: %s", mods, field.getName(), field.getType().getName()));
        }

        for (String line : lines)
            FMLLog.log.fatal(line);

        if (test) {
            throw new EnhancedRuntimeException("Could not find $VALUES field for enum: " + enumType.getName()) {
                @Override
                protected void printStackTrace(WrappedPrintStream stream) {
                    for (String line : lines)
                        stream.println(line);
                }
            };
        }
        return null;
    }

    if (test) {
        Object ctr = null;
        Exception ex = null;
        try {
            ctr = getConstructorAccessor(enumType, paramTypes);
        } catch (Exception e) {
            ex = e;
        }
        if (ctr == null || ex != null) {
            throw new EnhancedRuntimeException(
                    String.format("Could not find constructor for Enum %s", enumType.getName()), ex) {
                private String toString(Class<?>[] cls) {
                    StringBuilder b = new StringBuilder();
                    for (int x = 0; x < cls.length; x++) {
                        b.append(cls[x].getName());
                        if (x != cls.length - 1)
                            b.append(", ");
                    }
                    return b.toString();
                }

                @Override
                protected void printStackTrace(WrappedPrintStream stream) {
                    stream.println("Target Arguments:");
                    stream.println("    java.lang.String, int, " + toString(paramTypes));
                    stream.println("Found Constructors:");
                    for (Constructor<?> ctr : enumType.getDeclaredConstructors()) {
                        stream.println("    " + toString(ctr.getParameterTypes()));
                    }
                }
            };
        }
        return null;
    }

    valuesField.setAccessible(true);

    try {
        T[] previousValues = (T[]) valuesField.get(enumType);
        T newValue = makeEnum(enumType, enumName, previousValues.length, paramTypes, paramValues);
        setFailsafeFieldValue(valuesField, null, ArrayUtils.add(previousValues, newValue));
        cleanEnumCache(enumType);

        return newValue;
    } catch (Exception e) {
        FMLLog.log.error("Error adding enum with EnumHelper.", e);
        throw new RuntimeException(e);
    }
}

From source file:org.codehaus.groovy.grails.compiler.web.ControllerActionTransformer.java

private void processMethods(ClassNode classNode, SourceUnit source, GeneratorContext context) {

    List<MethodNode> deferredNewMethods = new ArrayList<MethodNode>();
    for (MethodNode method : classNode.getMethods()) {
        if (!method.isStatic() && method.isPublic()
                && method.getAnnotations(ACTION_ANNOTATION_NODE.getClassNode()).isEmpty()
                && method.getLineNumber() >= 0) {

            if (method.getReturnType().getName().equals(VOID_TYPE) || isExceptionHandlingMethod(method))
                continue;

            final List<MethodNode> declaredMethodsWithThisName = classNode.getDeclaredMethods(method.getName());
            if (declaredMethodsWithThisName != null) {
                final int numberOfNonExceptionHandlerMethodsWithThisName = org.apache.commons.collections.CollectionUtils
                        .countMatches(declaredMethodsWithThisName, new Predicate() {
                            public boolean evaluate(Object object) {
                                return !isExceptionHandlingMethod((MethodNode) object);
                            }// ww  w. j  a v a2  s.  co m
                        });
                if (numberOfNonExceptionHandlerMethodsWithThisName > 1) {
                    String message = "Controller actions may not be overloaded.  The [" + method.getName()
                            + "] action has been overloaded in [" + classNode.getName() + "].";
                    GrailsASTUtils.error(source, method, message);
                }
            }
            MethodNode wrapperMethod = convertToMethodAction(classNode, method, source, context);
            if (wrapperMethod != null) {
                deferredNewMethods.add(wrapperMethod);
            }
        }
    }
    Collection<MethodNode> exceptionHandlerMethods = getExceptionHandlerMethods(classNode, source);

    final FieldNode exceptionHandlerMetaDataField = classNode.getField(EXCEPTION_HANDLER_META_DATA_FIELD_NAME);
    if (exceptionHandlerMetaDataField == null
            || !exceptionHandlerMetaDataField.getDeclaringClass().equals(classNode)) {
        final ListExpression listOfExceptionHandlerMetaData = new ListExpression();
        for (final MethodNode exceptionHandlerMethod : exceptionHandlerMethods) {
            final Class<?> exceptionHandlerExceptionType = exceptionHandlerMethod.getParameters()[0].getType()
                    .getPlainNodeReference().getTypeClass();
            final String exceptionHandlerMethodName = exceptionHandlerMethod.getName();
            final ArgumentListExpression defaultControllerExceptionHandlerMetaDataCtorArgs = new ArgumentListExpression();
            defaultControllerExceptionHandlerMetaDataCtorArgs
                    .addExpression(new ConstantExpression(exceptionHandlerMethodName));
            defaultControllerExceptionHandlerMetaDataCtorArgs
                    .addExpression(new ClassExpression(new ClassNode(exceptionHandlerExceptionType)));
            listOfExceptionHandlerMetaData.addExpression(new ConstructorCallExpression(
                    new ClassNode(DefaultControllerExceptionHandlerMetaData.class),
                    defaultControllerExceptionHandlerMetaDataCtorArgs));
        }
        classNode.addField(EXCEPTION_HANDLER_META_DATA_FIELD_NAME,
                Modifier.STATIC | Modifier.PRIVATE | Modifier.FINAL, new ClassNode(List.class),
                listOfExceptionHandlerMetaData);
    }

    for (MethodNode newMethod : deferredNewMethods) {
        classNode.addMethod(newMethod);
    }
}

From source file:solidstack.reflect.Dumper.java

public void dumpTo(Object o, DumpWriter out) {
    try {//from   w w  w.j a  v  a  2  s . com
        if (o == null) {
            out.append("<null>");
            return;
        }
        Class<?> cls = o.getClass();
        if (cls == String.class) {
            out.append("\"").append(((String) o).replace("\\", "\\\\").replace("\n", "\\n").replace("\r", "\\r")
                    .replace("\t", "\\t").replace("\"", "\\\"")).append("\"");
            return;
        }
        if (o instanceof CharSequence) {
            out.append("(").append(o.getClass().getName()).append(")");
            dumpTo(o.toString(), out);
            return;
        }
        if (cls == char[].class) {
            out.append("(char[])");
            dumpTo(String.valueOf((char[]) o), out);
            return;
        }
        if (cls == byte[].class) {
            out.append("byte[").append(Integer.toString(((byte[]) o).length)).append("]");
            return;
        }
        if (cls == Class.class) {
            out.append(((Class<?>) o).getCanonicalName()).append(".class");
            return;
        }
        if (cls == File.class) {
            out.append("File( \"").append(((File) o).getPath()).append("\" )");
            return;
        }
        if (cls == AtomicInteger.class) {
            out.append("AtomicInteger( ").append(Integer.toString(((AtomicInteger) o).get())).append(" )");
            return;
        }
        if (cls == AtomicLong.class) {
            out.append("AtomicLong( ").append(Long.toString(((AtomicLong) o).get())).append(" )");
            return;
        }
        if (o instanceof ClassLoader) {
            out.append(o.getClass().getCanonicalName());
            return;
        }

        if (cls == java.lang.Short.class || cls == java.lang.Long.class || cls == java.lang.Integer.class
                || cls == java.lang.Float.class || cls == java.lang.Byte.class
                || cls == java.lang.Character.class || cls == java.lang.Double.class
                || cls == java.lang.Boolean.class || cls == BigInteger.class || cls == BigDecimal.class) {
            out.append("(").append(cls.getSimpleName()).append(")").append(o.toString());
            return;
        }

        String className = cls.getCanonicalName();
        if (className == null)
            className = cls.getName();
        out.append(className);

        if (this.skip.contains(className) || o instanceof java.lang.Thread) {
            out.append(" (skipped)");
            return;
        }

        Integer id = this.visited.get(o);
        if (id == null) {
            id = ++this.id;
            this.visited.put(o, id);
            if (!this.hideIds)
                out.append(" <id=" + id + ">");
        } else {
            out.append(" <refid=" + id + ">");
            return;
        }

        if (cls.isArray()) {
            if (Array.getLength(o) == 0)
                out.append(" []");
            else {
                out.newlineOrSpace().append("[").newlineOrSpace().indent().setFirst();
                int rowCount = Array.getLength(o);
                for (int i = 0; i < rowCount; i++) {
                    out.comma();
                    dumpTo(Array.get(o, i), out);
                }
                out.newlineOrSpace().unIndent().append("]");
            }
        } else if (o instanceof Collection && !this.overriddenCollection.contains(className)) {
            Collection<?> list = (Collection<?>) o;
            if (list.isEmpty())
                out.append(" []");
            else {
                out.newlineOrSpace().append("[").newlineOrSpace().indent().setFirst();
                for (Object value : list) {
                    out.comma();
                    dumpTo(value, out);
                }
                out.newlineOrSpace().unIndent().append("]");
            }
        } else if (o instanceof Properties && !this.overriddenCollection.contains(className)) // Properties is a Map, so it must come before the Map
        {
            Field def = cls.getDeclaredField("defaults");
            if (!def.isAccessible())
                def.setAccessible(true);
            Properties defaults = (Properties) def.get(o);
            Hashtable<?, ?> map = (Hashtable<?, ?>) o;
            out.newlineOrSpace().append("[").newlineOrSpace().indent().setFirst();
            for (Map.Entry<?, ?> entry : map.entrySet()) {
                out.comma();
                dumpTo(entry.getKey(), out);
                out.append(": ");
                dumpTo(entry.getValue(), out);
            }
            if (defaults != null && !defaults.isEmpty()) {
                out.comma().append("defaults: ");
                dumpTo(defaults, out);
            }
            out.newlineOrSpace().unIndent().append("]");
        } else if (o instanceof Map && !this.overriddenCollection.contains(className)) {
            Map<?, ?> map = (Map<?, ?>) o;
            if (map.isEmpty())
                out.append(" []");
            else {
                out.newlineOrSpace().append("[").newlineOrSpace().indent().setFirst();
                for (Map.Entry<?, ?> entry : map.entrySet()) {
                    out.comma();
                    dumpTo(entry.getKey(), out);
                    out.append(": ");
                    dumpTo(entry.getValue(), out);
                }
                out.newlineOrSpace().unIndent().append("]");
            }
        } else if (o instanceof Method) {
            out.newlineOrSpace().append("{").newlineOrSpace().indent().setFirst();

            Field field = cls.getDeclaredField("clazz");
            if (!field.isAccessible())
                field.setAccessible(true);
            out.comma().append("clazz").append(": ");
            dumpTo(field.get(o), out);

            field = cls.getDeclaredField("name");
            if (!field.isAccessible())
                field.setAccessible(true);
            out.comma().append("name").append(": ");
            dumpTo(field.get(o), out);

            field = cls.getDeclaredField("parameterTypes");
            if (!field.isAccessible())
                field.setAccessible(true);
            out.comma().append("parameterTypes").append(": ");
            dumpTo(field.get(o), out);

            field = cls.getDeclaredField("returnType");
            if (!field.isAccessible())
                field.setAccessible(true);
            out.comma().append("returnType").append(": ");
            dumpTo(field.get(o), out);

            out.newlineOrSpace().unIndent().append("}");
        } else {
            ArrayList<Field> fields = new ArrayList<Field>();
            while (cls != Object.class) {
                Field[] fs = cls.getDeclaredFields();
                for (Field field : fs)
                    fields.add(field);
                cls = cls.getSuperclass();
            }

            Collections.sort(fields, new Comparator<Field>() {
                public int compare(Field left, Field right) {
                    return left.getName().compareTo(right.getName());
                }
            });

            if (fields.isEmpty())
                out.append(" {}");
            else {
                out.newlineOrSpace().append("{").newlineOrSpace().indent().setFirst();
                for (Field field : fields)
                    if ((field.getModifiers() & Modifier.STATIC) == 0)
                        if (!this.hideTransients || (field.getModifiers() & Modifier.TRANSIENT) == 0) {
                            out.comma().append(field.getName()).append(": ");

                            if (!field.isAccessible())
                                field.setAccessible(true);

                            if (field.getType().isPrimitive())
                                if (field.getType() == boolean.class) // TODO More?
                                    out.append(field.get(o).toString());
                                else
                                    out.append("(").append(field.getType().getName()).append(")")
                                            .append(field.get(o).toString());
                            else
                                dumpTo(field.get(o), out);
                        }
                out.newlineOrSpace().unIndent().append("}");
            }
        }
    } catch (IOException e) {
        throw new FatalIOException(e);
    } catch (Exception e) {
        dumpTo(e.toString(), out);
    }
}

From source file:com.all.app.DefaultContext.java

private void checkInvokePredestroy(Method method, Object ob) {
    boolean annotationPresent = false;
    boolean noArguments = method.getParameterTypes().length == 0;
    boolean isVoid = method.getReturnType().equals(void.class);
    boolean isPublic = (method.getModifiers() & Modifier.PUBLIC) == Modifier.PUBLIC;
    boolean isNotStatic = (method.getModifiers() & Modifier.STATIC) != Modifier.STATIC;
    Annotation[] annotations = method.getAnnotations();
    for (Annotation annotation : annotations) {
        if (annotation.getClass().getName().contains("PreDestroy")
                || annotation.toString().contains("PreDestroy")) {
            annotationPresent = true;//from   ww w  .  j av  a2  s. com
        }
    }
    if (annotationPresent && noArguments && isPublic && isNotStatic && isVoid) {
        try {
            method.invoke(ob);
        } catch (Exception e) {
            log.error(e, e);
        }
    }

}

From source file:org.gvnix.addon.jpa.addon.audit.providers.envers.EnversRevisionLogEntityMetadataBuilder.java

private ClassOrInterfaceTypeDetails getRevisionListener() {

    // Check class exists
    ClassOrInterfaceTypeDetails innerClass = governorTypeDetails.getDeclaredInnerType(revisionListenerType);

    if (innerClass != null) {
        // If class exists (already push-in) we can do nothing
        return innerClass;
    }//w  w  w  .j a  v a 2s  . c  o m

    // Create inner class

    ClassOrInterfaceTypeDetailsBuilder classBuilder = new ClassOrInterfaceTypeDetailsBuilder(
            context.getMetadataId(), Modifier.PUBLIC + Modifier.STATIC, revisionListenerType,
            PhysicalTypeCategory.CLASS);
    classBuilder.addImplementsType(REVISION_LISTENER);

    classBuilder.addMethod(getNewRevisionMethod());

    return classBuilder.build();
}

From source file:org.gvnix.web.screen.roo.addon.EntityBatchMetadata.java

/**
 * <p>//  ww w. j a v a  2s  .c  om
 * Gets method for target operation.
 * </p>
 * <p>
 * First, try to look for it in governors. If not exists, create a new
 * method.
 * </p>
 * 
 * @param methodName
 * @param targetMethod
 * @return
 */
private MethodMetadata getMethodFor(JavaSymbolName methodName, String targetMethod) {

    // Define method parameter types
    List<AnnotatedJavaType> parameterTypes = getParamsTypesForMethods();

    // Check if a method with the same signature already exists in the
    // target type
    MethodMetadata method = methodExists(methodName, parameterTypes.get(0).getJavaType());
    if (method != null) {
        // If it already exists, just return null and omit its
        // generation via the ITD
        return null;
    }

    // Define method annotations
    List<AnnotationMetadataBuilder> annotations = getAnnotationsForMethods();

    // Define method throws types (none in this case)
    List<JavaType> throwsTypes = new ArrayList<JavaType>();

    // Define method parameter names
    List<JavaSymbolName> parameterNames = getParamsNamesForMethods();

    // Create the method body
    InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    /*
     * for (${entityName} entity : entities.list) {
     * entity.${targetMethod}(); }
     */
    bodyBuilder.appendFormalLine(MessageFormat.format("for ({0} entity : entities.list) '{'",
            new Object[] { destination.getSimpleTypeName() }));
    bodyBuilder.indent();
    bodyBuilder.appendFormalLine(MessageFormat.format("entity.{0}();", new Object[] { targetMethod }));
    bodyBuilder.indentRemove();
    bodyBuilder.appendFormalLine("}");

    // Use the MethodMetadataBuilder for easy creation of MethodMetadata
    MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC | Modifier.STATIC,
            methodName, JavaType.VOID_PRIMITIVE, parameterTypes, parameterNames, bodyBuilder);
    methodBuilder.setAnnotations(annotations);
    methodBuilder.setThrowsTypes(throwsTypes);

    return methodBuilder.build();

}

From source file:org.gvnix.addon.jpa.addon.query.JpaQueryMetadata.java

/**
 * Generate method to get the filterBy information
 * //from w  w  w  . j av  a  2s. co  m
 * @param fieldsToProcess
 * @return
 */
private MethodMetadata getFilterByMethod(Map<FieldMetadata, AnnotationMetadata> fieldsToProcess) {

    // public Map<String,List<String>> getJpaQueryFilterBy() {

    // Check if a method with the same signature already exists in the
    // target type
    final MethodMetadata method = methodExists(GET_FILTERBY_DEFINITION, new ArrayList<AnnotatedJavaType>());
    if (method != null) {
        // If it already exists, just return the method and omit its
        // generation via the ITD
        return method;
    }

    // Define method annotations (none in this case)
    List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();

    // Define method throws types (none in this case)
    List<JavaType> throwsTypes = new ArrayList<JavaType>();

    // Define method parameter types (none in this case)
    List<AnnotatedJavaType> parameterTypes = new ArrayList<AnnotatedJavaType>();

    // Define method parameter names (none in this case)
    List<JavaSymbolName> parameterNames = new ArrayList<JavaSymbolName>();

    // Create the method body
    InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    buildGetFilterByDefinitionMethodBody(bodyBuilder, fieldsToProcess);

    // Use the MethodMetadataBuilder for easy creation of MethodMetadata
    MethodMetadataBuilder methodBuilder = new MethodMetadataBuilder(getId(), Modifier.PUBLIC + Modifier.STATIC,
            GET_FILTERBY_DEFINITION, MAP_STRING_LIST_STRING, parameterTypes, parameterNames, bodyBuilder);
    methodBuilder.setAnnotations(annotations);
    methodBuilder.setThrowsTypes(throwsTypes);

    return methodBuilder.build(); // Build and return a MethodMetadata
                                  // instance
}