mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-04 21:59:10 +01:00
find and bind extension points automatically
This commit is contained in:
@@ -46,7 +46,7 @@ import java.io.IOException;
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@ExtensionPoint
|
||||
@ExtensionPoint(multi=false)
|
||||
public interface FileSystem
|
||||
{
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user