use of org.apache.ignite.configuration.annotation.InjectedName in project ignite-3 by apache.
the class Processor method getInterfaceGetMethodType.
/**
* Get types for configuration classes generation.
*
* @param field Field.
* @return Bundle with all types for configuration
*/
private static TypeName getInterfaceGetMethodType(VariableElement field) {
TypeName interfaceGetMethodType = null;
TypeName baseType = TypeName.get(field.asType());
ConfigValue confAnnotation = field.getAnnotation(ConfigValue.class);
if (confAnnotation != null) {
interfaceGetMethodType = Utils.getConfigurationInterfaceName((ClassName) baseType);
}
NamedConfigValue namedConfigAnnotation = field.getAnnotation(NamedConfigValue.class);
if (namedConfigAnnotation != null) {
ClassName interfaceGetType = Utils.getConfigurationInterfaceName((ClassName) baseType);
TypeName viewClassType = Utils.getViewName((ClassName) baseType);
TypeName changeClassType = Utils.getChangeName((ClassName) baseType);
interfaceGetMethodType = ParameterizedTypeName.get(ClassName.get(NamedConfigurationTree.class), interfaceGetType, viewClassType, changeClassType);
}
Value valueAnnotation = field.getAnnotation(Value.class);
PolymorphicId polymorphicIdAnnotation = field.getAnnotation(PolymorphicId.class);
InjectedName injectedNameAnnotation = field.getAnnotation(InjectedName.class);
InternalId internalIdAnnotation = field.getAnnotation(InternalId.class);
if (valueAnnotation != null || polymorphicIdAnnotation != null || injectedNameAnnotation != null || internalIdAnnotation != null) {
// It is necessary to use class names without loading classes so that we won't
// accidentally get NoClassDefFoundError
ClassName confValueClass = ClassName.get("org.apache.ignite.configuration", "ConfigurationValue");
TypeName genericType = baseType;
if (genericType.isPrimitive()) {
genericType = genericType.box();
}
interfaceGetMethodType = ParameterizedTypeName.get(confValueClass, genericType);
}
return interfaceGetMethodType;
}
Aggregations