
com.develhack.lombok.javac.handlers.assertion.AbstractNumericalAssertionHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of develhacked-lombok Show documentation
Show all versions of develhacked-lombok Show documentation
The library enhancing Java classes at compilation by annotations that contained in the Develhack Core Library.
The newest version!
package com.develhack.lombok.javac.handlers.assertion;
import java.lang.annotation.Annotation;
import com.develhack.lombok.NameResolver;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
abstract class AbstractNumericalAssertionHandler extends AbstractAssertionHandler {
public AbstractNumericalAssertionHandler(Class annotationType) {
super(annotationType);
}
@Override
protected boolean checkVariableType(JCVariableDecl variable) {
if (isPrimitiveNumber(variable) || isBoxedNumber(variable)) return true;
String argumentTypeName = variable.vartype.toString();
if (NameResolver.resolveFQN(sourceNode, argumentTypeName, NameResolver.BIG_INTEGER, NameResolver.BIG_DECIMAL) != null) {
return true;
}
sourceNode.addWarning(String.format("@%s is only applicable to the numerical type.", getAnnotationName()));
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy