prop.getField().getJavaDoc().setFullText(option.getDescription()); prop.getField().setStringInitializer(option.getDefaultValue()); } else if ("long".equals(type) || "java.lang.Long".equals(type)) { prop.getField().setLiteralInitializer(value); } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) { prop.getField().setLiteralInitializer(option.getDefaultValue()); } else if (!Strings.isBlank(option.getEnums())) { String enumShortName = type.substring(type.lastIndexOf(".") + 1); prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue()); javaClass.addImport(model.getJavaType());
FieldSource<JavaClassSource> field = property.getField(); field.setVisibility(visibility); for (String annotation : annotations)
public static JavaClassSource createGreetingPropertiesClass(JavaClassSource current) { JavaClassSource source = Roaster.create(JavaClassSource.class).setName("GreetingProperties").setPackage(current.getPackage()); source.addAnnotation(Component.class); source.addAnnotation(ConfigurationProperties.class).setStringValue("greeting"); source.addProperty(String.class, "message").getField().setStringInitializer("Hello, %s!"); return source; }
bogus.getField().getJavaDoc().setText("Whether to enable auto configuration of the " + model.getName() + " data format. This is enabled by default."); bogus.removeAccessor(); bogus.removeMutator(); prop.getField().addAnnotation(Deprecated.class); prop.getAccessor().addAnnotation(Deprecated.class); prop.getMutator().addAnnotation(Deprecated.class); prop.getField().getJavaDoc().setFullText(desc); prop.getField().setStringInitializer(option.getDefaultValue()); } else if ("long".equals(option.getJavaType()) || "java.lang.Long".equals(option.getJavaType())) { prop.getField().setLiteralInitializer(value); } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) { prop.getField().setLiteralInitializer(option.getDefaultValue()); } else if (!Strings.isBlank(option.getEnumValues())) { String enumShortName = type.substring(type.lastIndexOf(".") + 1); prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue()); javaClass.addImport(model.getJavaType());
bogus.getField().getJavaDoc().setText("Whether to enable auto configuration of the " + model.getName() + " language. This is enabled by default."); bogus.removeAccessor(); bogus.removeMutator(); prop.getField().addAnnotation(Deprecated.class); prop.getAccessor().addAnnotation(Deprecated.class); prop.getMutator().addAnnotation(Deprecated.class); prop.getField().getJavaDoc().setFullText(desc); prop.getField().setStringInitializer(option.getDefaultValue()); } else if ("long".equals(option.getJavaType()) || "java.lang.Long".equals(option.getJavaType())) { prop.getField().setLiteralInitializer(value); } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) { prop.getField().setLiteralInitializer(option.getDefaultValue()); } else if (!Strings.isBlank(option.getEnumValues())) { String enumShortName = type.substring(type.lastIndexOf(".") + 1); prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue()); javaClass.addImport(model.getJavaType());
bogus.getField().getJavaDoc().setText("Whether to enable auto configuration of the " + scheme + " component. This is enabled by default."); bogus.removeAccessor(); bogus.removeMutator(); && (javaClassSource == null || (javaClassSource.isClass() && !javaClassSource.isAbstract()))) { prop.getField().addAnnotation(NestedConfigurationProperty.class); prop.getField().addAnnotation(Deprecated.class); prop.getAccessor().addAnnotation(Deprecated.class); prop.getMutator().addAnnotation(Deprecated.class); prop.getField().getJavaDoc().setFullText(desc); prop.getField().setStringInitializer(option.getDefaultValue()); } else if ("long".equals(option.getJavaType()) || "java.lang.Long".equals(option.getJavaType())) { prop.getField().setLiteralInitializer(value); } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) { prop.getField().setLiteralInitializer(option.getDefaultValue()); } else if (!Strings.isBlank(option.getEnums())) { String enumShortName = type.substring(type.lastIndexOf(".") + 1); prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue()); javaClass.addImport(model.getJavaType());
&& !optionClass.isAnnotation() && !Modifier.isAbstract(optionClass.getModifiers())) { prop.getField().addAnnotation(NestedConfigurationProperty.class); prop.getField().addAnnotation(Deprecated.class); prop.getAccessor().addAnnotation(Deprecated.class); prop.getMutator().addAnnotation(Deprecated.class); description = mutator.getJavaDoc().getFullText(); } else if (sourceProp.hasField()) { description = sourceProp.getField().getJavaDoc().getFullText(); prop.getField().getJavaDoc().setFullText(description); optionName = sourceProp.hasField() ? sourceProp.getField().getName() : null; prop.getField().getJavaDoc().setFullText(description); prop.getField().setLiteralInitializer(value); } else if ("integer".equals(type) || "boolean".equals(type)) { prop.getField().setLiteralInitializer(defaultValue); } else if ("string".equals(type)) { prop.getField().setStringInitializer(defaultValue); } else if (anEnum) { String enumShortName = optionClass.getSimpleName(); prop.getField().setLiteralInitializer(enumShortName + "." + defaultValue); javaClass.addImport(model.getJavaType());
prop.getField().getJavaDoc().setFullText(option.getDescription()); prop.getField().setStringInitializer(option.getDefaultValue()); } else if ("long".equals(type) || "java.lang.Long".equals(type)) { prop.getField().setLiteralInitializer(value); } else if ("integer".equals(option.getType()) || "boolean".equals(option.getType())) { prop.getField().setLiteralInitializer(option.getDefaultValue()); } else if (!Strings.isBlank(option.getEnums())) { String enumShortName = type.substring(type.lastIndexOf(".") + 1); prop.getField().setLiteralInitializer(enumShortName + "." + option.getDefaultValue()); commonClass.addImport(model.getJavaType());