org.bsc.reporting.sink.SinkDelegate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of confluence-reporting-maven-plugin Show documentation
Show all versions of confluence-reporting-maven-plugin Show documentation
plugin that document a project (using maven site style) and send result to a live confluence site
[http://www.atlassian.com/software/confluence/]
package org.bsc.reporting.sink;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import javax.swing.text.AttributeSet;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.SinkEventAttributeSet;
import org.apache.maven.doxia.sink.SinkEventAttributes;
public class SinkDelegate implements InvocationHandler
{
private final Sink sink;
public SinkDelegate( Sink sink ) {
this.sink = sink;
}
/** {@inheritDoc} */
public Object invoke( Object proxy, Method method, Object[] args )
throws Throwable
{
Class>[] parameterTypes = method.getParameterTypes();
for ( int i = parameterTypes.length - 1; i >= 0; i-- )
{
if ( AttributeSet.class.isAssignableFrom( parameterTypes[i] ) )
{
parameterTypes[i] = SinkEventAttributes.class;
}
}
if ( args != null )
{
for ( int i = args.length - 1; i >= 0; i-- )
{
if ( AttributeSet.class.isInstance( args[i] ) )
{
args[i] = new SinkEventAttributeSet( (AttributeSet) args[i] );
}
}
}
Method target = Sink.class.getMethod( method.getName(), parameterTypes );
return target.invoke( sink, args );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy