Package org.jboss.invocation.proxy.reflection

Examples of org.jboss.invocation.proxy.reflection.ClassMetadataSource


    }

    @Override
    public ClassMetadataSource getClassMetadata(final Class<?> clazz) {
        final ClassReflectionIndex<?> index = this.index.getClassIndex(clazz);
        return new ClassMetadataSource() {
            @Override
            public Collection<Method> getDeclaredMethods() {
                return index.getMethods();
            }
View Full Code Here


     * @param override the method body creator to use
     */
    protected void overridePublicMethods(MethodBodyCreator override) {
        Class<?> c = getSuperClass();
        while (c != null) {
            ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(c);

            for (Method method : data.getDeclaredMethods()) {
                MethodIdentifier identifier = MethodIdentifier.getIdentifierForMethod(method);
                if (!Modifier.isPublic(method.getModifiers()) || Modifier.isFinal(method.getModifiers())) {
                    continue;
                }
                if (!SKIP_BY_DEFAULT.contains(identifier)) {
View Full Code Here

     * @param override the method body creator to use
     */
    protected void overrideAllMethods(MethodBodyCreator override) {
        Class<?> currentClass = getSuperClass();
        while (currentClass != null && currentClass != Object.class) {
            ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(currentClass);
            for (Method method : data.getDeclaredMethods()) {
                // do not override static or private methods
                if (Modifier.isStatic(method.getModifiers()) || Modifier.isPrivate(method.getModifiers())) {
                    continue;
                }
                MethodIdentifier identifier = MethodIdentifier.getIdentifierForMethod(method);
View Full Code Here

     * @param creator the method body creator to use
     * @return true if the method was not already overridden
     */
    protected boolean overrideEquals(MethodBodyCreator creator) {
        Method equals = null;
        ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
        try {
            equals = data.getMethod("equals", Boolean.TYPE, Object.class);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return overrideMethod(equals, MethodIdentifier.getIdentifierForMethod(equals), creator);
    }
View Full Code Here

     * @return true if the method was not already overridden
     */
    protected boolean overrideHashcode(MethodBodyCreator creator) {

        Method hashCode = null;
        ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
        try {
            hashCode = data.getMethod("hashCode", Integer.TYPE);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return overrideMethod(hashCode, MethodIdentifier.getIdentifierForMethod(hashCode), creator);
    }
View Full Code Here

     * @param creator the method body creator to use
     * @return true if the method was not already overridden
     */
    protected boolean overrideToString(MethodBodyCreator creator) {
        Method toString = null;
        final ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
        try {
            toString = data.getMethod("toString", String.class);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return overrideMethod(toString, MethodIdentifier.getIdentifierForMethod(toString), creator);
    }
View Full Code Here

     *
     * @param creator the method body creator to use
     */
    protected boolean overrideFinalize(MethodBodyCreator creator) {
        Method finalize = null;
        final ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
        try {
            finalize = data.getMethod("finalize", void.class);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return overrideMethod(finalize, MethodIdentifier.getIdentifierForMethod(finalize), creator);
    }
View Full Code Here

                    toProcess.add(i);
                }
            }
        }
        for(final Class<?> c : interfaces) {
            ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(c);
            for (Method method : data.getDeclaredMethods()) {
                overrideMethod(method, MethodIdentifier.getIdentifierForMethod(method), override);
            }
        }
        return true;
    }
View Full Code Here

     * Adds constructors that delegate the the superclass constructor for all non-private constructors present on the superclass
     *
     * @param creator the constructor body creator to use
     */
    protected void createConstructorDelegates(ConstructorBodyCreator creator) {
        ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(getSuperClass());
        for (Constructor<?> constructor : data.getConstructors()) {
            if (!Modifier.isPrivate(constructor.getModifiers())) {
                creator.overrideConstructor(classFile.addMethod(AccessFlag.PUBLIC, "<init>", "V", DescriptorUtils
                        .parameterDescriptors(constructor.getParameterTypes())), constructor);
            }
        }
View Full Code Here

    }

    @Override
    public ClassMetadataSource getClassMetadata(final Class<?> clazz) {
        final ClassReflectionIndex<?> index = this.index.getClassIndex(clazz);
        return new ClassMetadataSource() {
            @Override
            public Collection<Method> getDeclaredMethods() {
                return index.getMethods();
            }
View Full Code Here

TOP

Related Classes of org.jboss.invocation.proxy.reflection.ClassMetadataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.