com.softicar.platform.common.code.reference.point.ISourceCodeReferencePoint Maven / Gradle / Ivy
Show all versions of platform-common Show documentation
package com.softicar.platform.common.code.reference.point;
import com.softicar.platform.common.core.i18n.IDisplayString;
import com.softicar.platform.common.core.i18n.IDisplayable;
import java.util.UUID;
/**
* Implemented by classes representing reference points in the source code.
*
* Classes implementing this interface need to define a {@link UUID} by using
* the annotation {@link SourceCodeReferencePointUuid}.
*
* @author Oliver Richers
*/
public interface ISourceCodeReferencePoint extends IDisplayable {
/**
* The default implementation returns the canonical name of this class.
*
* @return the canonical class name (never null)
*/
@Override
default IDisplayString toDisplay() {
return IDisplayString.create(getClass().getSimpleName());
}
/**
* Returns the {@link UUID} that uniquely identifies this
* {@link ISourceCodeReferencePoint}.
*
* Throws an {@link Exception} if this class has no valid
* {@link SourceCodeReferencePointUuid} annotation.
*
* @return the {@link UUID} (never null)
*/
default UUID getAnnotatedUuid() {
return SourceCodeReferencePoints.getUuidOrThrow(getClass());
}
}