Skip to content
Permalink
Browse files
comments, headers, warnings
  • Loading branch information
mbenson committed Jul 16, 2010
1 parent be9753a commit 65310aa51b325da26a37fa37c0d455f154528fb8
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 17 deletions.
@@ -1,5 +1,26 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.commons.proxy;

/**
* ProxyFactory interface.
* @since 2.0
*/
public interface ProxyFactory
{
//**********************************************************************************************************************
@@ -14,7 +35,6 @@
* @param proxyClass the class/interface that the proxy should implement
* @return a proxy which delegates to the object provided by the target <code>delegateProvider>
*/
@SuppressWarnings( "unchecked" )
public <T> T createDelegatorProxy( ClassLoader classLoader, ObjectProvider<T> delegateProvider,
Class<T> proxyClass );

@@ -28,7 +48,6 @@ public <T> T createDelegatorProxy( ClassLoader classLoader, ObjectProvider<T> de
* @return a proxy which passes through a {@link Interceptor interceptor} before eventually reaching the
* <code>target</code> object.
*/
@SuppressWarnings( "unchecked" )
public <T> T createInterceptorProxy( Object target, Interceptor interceptor,
Class<T> proxyClass );

@@ -43,7 +62,6 @@ public <T> T createInterceptorProxy( Object target, Interceptor interceptor,
* @return a proxy which passes through a {@link Interceptor interceptor} before eventually reaching the
* <code>target</code> object.
*/
@SuppressWarnings( "unchecked" )
public <T> T createInterceptorProxy( ClassLoader classLoader,
Object target,
Interceptor interceptor,
@@ -57,7 +75,6 @@ public <T> T createInterceptorProxy( ClassLoader classLoader,
* @param proxyClass the class/interface that the proxy should implement
* @return a proxy which uses the provided {@link Invoker} to handle all method invocations
*/
@SuppressWarnings( "unchecked" )
public <T> T createInvokerProxy( Invoker invoker, Class<T> proxyClass );

/**
@@ -68,7 +85,6 @@ public <T> T createInterceptorProxy( ClassLoader classLoader,
* @param proxyClass the class/interface that the proxy should implement
* @return a proxy which uses the provided {@link Invoker} to handle all method invocations
*/
@SuppressWarnings( "unchecked" )
public <T> T createInvokerProxy( ClassLoader classLoader, Invoker invoker,
Class<T> proxyClass );

@@ -80,15 +96,14 @@ public <T> T createInvokerProxy( ClassLoader classLoader, Invoker invoker,
* @param proxyClass the class/interface that the proxy should implement
* @return a proxy which delegates to the object provided by the target object provider
*/
@SuppressWarnings("unchecked")
public <T> T createDelegatorProxy( ObjectProvider<T> delegateProvider, Class<T> proxyClass );
/**
* Returns true if all <code>proxyClasses</code> are interfaces.
*
* @param proxyClasses the proxy classes
* @return true if all <code>proxyClasses</code> are interfaces
*/
public boolean canProxy( Class... proxyClasses );
public boolean canProxy( Class<?>... proxyClasses );

/**
* Creates a proxy which delegates to the object provided by <code>delegateProvider</code>. The proxy will be
@@ -98,7 +113,7 @@ public <T> T createInvokerProxy( ClassLoader classLoader, Invoker invoker,
* @param proxyClasses the interfaces that the proxy should implement
* @return a proxy which delegates to the object provided by the target object provider
*/
public Object createDelegatorProxy( ObjectProvider delegateProvider, Class... proxyClasses );
public Object createDelegatorProxy( ObjectProvider<?> delegateProvider, Class<?>... proxyClasses );

/**
* Creates a proxy which delegates to the object provided by <code>delegateProvider</code>.
@@ -108,8 +123,8 @@ public <T> T createInvokerProxy( ClassLoader classLoader, Invoker invoker,
* @param proxyClasses the interfaces that the proxy should implement
* @return a proxy which delegates to the object provided by the target <code>delegateProvider>
*/
public Object createDelegatorProxy( ClassLoader classLoader, ObjectProvider delegateProvider,
Class... proxyClasses );
public Object createDelegatorProxy( ClassLoader classLoader, ObjectProvider<?> delegateProvider,
Class<?>... proxyClasses );

/**
* Creates a proxy which passes through a {@link Interceptor interceptor} before eventually reaching the
@@ -122,7 +137,7 @@ public Object createDelegatorProxy( ClassLoader classLoader, ObjectProvider dele
* <code>target</code> object.
*/
public Object createInterceptorProxy( Object target, Interceptor interceptor,
Class... proxyClasses );
Class<?>... proxyClasses );

/**
* Creates a proxy which passes through a {@link Interceptor interceptor} before eventually reaching the
@@ -136,7 +151,7 @@ public Object createInterceptorProxy( Object target, Interceptor interceptor,
* <code>target</code> object.
*/
public Object createInterceptorProxy( ClassLoader classLoader, Object target, Interceptor interceptor,
Class... proxyClasses );
Class<?>... proxyClasses );

/**
* Creates a proxy which uses the provided {@link Invoker} to handle all method invocations. The proxy will be
@@ -146,7 +161,7 @@ public Object createInterceptorProxy( ClassLoader classLoader, Object target, In
* @param proxyClasses the interfaces that the proxy should implement
* @return a proxy which uses the provided {@link Invoker} to handle all method invocations
*/
public Object createInvokerProxy( Invoker invoker, Class... proxyClasses );
public Object createInvokerProxy( Invoker invoker, Class<?>... proxyClasses );

/**
* Creates a proxy which uses the provided {@link Invoker} to handle all method invocations.
@@ -157,5 +172,5 @@ public Object createInterceptorProxy( ClassLoader classLoader, Object target, In
* @return a proxy which uses the provided {@link Invoker} to handle all method invocations
*/
public Object createInvokerProxy( ClassLoader classLoader, Invoker invoker,
Class... proxyClasses );
Class<?>... proxyClasses );
}
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.commons.proxy.impl;

import org.apache.commons.proxy.Interceptor;
@@ -14,7 +31,7 @@
import java.lang.reflect.Proxy;

public abstract class AbstractProxyFactory implements ProxyFactory
{
{
/**
* Returns true if all <code>proxyClasses</code> are interfaces.
*
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.commons.proxy.javassist;

import javassist.CannotCompileException;
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.commons.proxy.jdk;

import org.apache.commons.proxy.Interceptor;
@@ -14,12 +31,12 @@
import java.lang.reflect.Proxy;

public class JdkProxyFactory extends AbstractProxyFactory
{
{
//**********************************************************************************************************************
// ProxyFactory Implementation
//**********************************************************************************************************************


/**
* Creates a proxy which delegates to the object provided by <code>delegateProvider</code>.
*

0 comments on commit 65310aa

Please sign in to comment.