summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/exceptions/OrphanElementException.java
blob: 17c11802401269174dbdea62839db3bf9f7c02b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package ftbsc.lll.exceptions;

import javax.lang.model.element.Element;
import javax.lang.model.element.QualifiedNameable;

/**
 * Thrown when an annotated element that needs to be paired with
 * another does not match with any.
 * @since 0.5.0
 */
public class OrphanElementException extends RuntimeException {
   /**
    * Constructs an exception for the specified method.
    * @param element the orphan element
    */
   public OrphanElementException(Element element) {
      super(
         String.format(
            "Could not find a valid target for element %s.%s!",
            ((QualifiedNameable) element.getEnclosingElement()).getQualifiedName().toString(),
            element.getSimpleName().toString()
         )
      );
   }
}