find and bind extension points automatically

This commit is contained in:
Sebastian Sdorra
2013-01-18 09:39:32 +01:00
parent 8232a24344
commit e581751624
11 changed files with 762 additions and 781 deletions

View File

@@ -46,7 +46,7 @@ import java.io.IOException;
*
* @author Sebastian Sdorra
*/
@ExtensionPoint
@ExtensionPoint(multi=false)
public interface FileSystem
{

View File

@@ -47,5 +47,8 @@ import java.lang.annotation.Target;
*/
@Documented
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.CLASS)
public @interface ExtensionPoint {}
@Retention(RetentionPolicy.RUNTIME)
public @interface ExtensionPoint
{
boolean multi() default true;
}

View File

@@ -30,8 +30,13 @@
*/
package sonia.scm.plugin.ext;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.lang.annotation.Annotation;
@@ -60,6 +65,64 @@ public class AnnotatedClass<T extends Annotation>
this.annotatedClass = annotatedClass;
}
//~--- methods --------------------------------------------------------------
/**
* {@inheritDoc}
*
*
* @param obj
*
* @return
*/
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final AnnotatedClass<T> other = (AnnotatedClass<T>) obj;
return Objects.equal(annotation, other.annotation)
&& Objects.equal(annotatedClass, other.annotatedClass);
}
/**
* {@inheritDoc}
*
*
* @return
*/
@Override
public int hashCode()
{
return Objects.hashCode(annotation, annotatedClass);
}
/**
* {@inheritDoc}
*
*
* @return
*/
@Override
public String toString()
{
//J-
return Objects.toStringHelper(this)
.add("annotation", annotation)
.add("annotatedClass", annotatedClass)
.toString();
//J+
}
//~--- get methods ----------------------------------------------------------
/**