dorkbox.annotation.AnnotationDefaults Maven / Gradle / Ivy
/*
* Copyright 2014 XIAM Solutions B.V. The Netherlands (www.xiam.nl)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dorkbox.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* for specifying the default report methods, without constantly creating new objects
*/
public
class AnnotationDefaults {
public static final ReporterFunction getTypeName = new ReporterFunction() {
@Override
public
String report(Cursor cursor) {
return cursor.getTypeName();
}
};
public static final ReporterFunction> getAnnotationType = new ReporterFunction>() {
@Override
public
Class extends Annotation> report(Cursor cursor) {
return cursor.getAnnotationType();
}
};
public static final ReporterFunction getElementType = new ReporterFunction() {
@Override
public
ElementType report(Cursor cursor) {
return cursor.getElementType();
}
};
public static final ReporterFunction getMemberName = new ReporterFunction() {
@Override
public
String report(Cursor cursor) {
return cursor.getMemberName();
}
};
public static final ReporterFunction> getType = new ReporterFunction>() {
@Override
public
Class> report(Cursor cursor) {
return cursor.getType();
}
};
public static final ReporterFunction> getConstructor = new ReporterFunction>() {
@Override
public
Constructor> report(Cursor cursor) {
return cursor.getConstructor();
}
};
public static final ReporterFunction getField = new ReporterFunction() {
@Override
public
Field report(Cursor cursor) {
return cursor.getField();
}
};
public static final ReporterFunction getMethod = new ReporterFunction() {
@Override
public
Method report(Cursor cursor) {
return cursor.getMethod();
}
};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy