Files
alfresco-community-repo/source/java/org/alfresco/traitextender/ExtensionPoint.java
Raluca Munteanu 8674e2bfc8 Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125603 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2)
      125484 slanglois: MNT-16155 Update source headers - remove old Copyrights from Java and JSP dource files


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2016-04-26 12:48:49 +00:00

64 lines
1.5 KiB
Java

package org.alfresco.traitextender;
/**
* Defines a two-way interfacing mechanism between a {@link Trait} exposing
* object and an extension of that object.<br>
* The extended object can call methods of the {@link #extensionAPI} which will
* be able to interact with the extended object through the {@link #traitAPI}
* interface it was paired with in the extension point. The actual circumstances
* in which the extension methods are invoked are not defined by the extension
* point.
*
* @author Bogdan Horje
*/
public class ExtensionPoint<E, M extends Trait>
{
private Class<E> extensionAPI;
private Class<M> traitAPI;
public ExtensionPoint(Class<E> extensionAPI, Class<M> traitAPI)
{
super();
this.extensionAPI = extensionAPI;
this.traitAPI = traitAPI;
}
public Class<E> getExtensionAPI()
{
return this.extensionAPI;
}
public Class<M> getTraitAPI()
{
return this.traitAPI;
}
@Override
public int hashCode()
{
return extensionAPI.hashCode();
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof ExtensionPoint)
{
ExtensionPoint<?, ?> pointObj = (ExtensionPoint<?, ?>) obj;
return extensionAPI.equals(pointObj.extensionAPI) && traitAPI.equals(pointObj.traitAPI);
}
else
{
return false;
}
}
@Override
public String toString()
{
return "{" + extensionAPI.toString() + "," + traitAPI.toString() + "}";
}
}