io.vertx.codegen.format.CamelCase Java Examples

The following examples show how to use io.vertx.codegen.format.CamelCase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataObjectHelperGen.java    From vertx-codegen with Apache License 2.0 6 votes vote down vote up
private Case getCase(DataObjectModel model) {
  AnnotationValueInfo abc = model
    .getAnnotations()
    .stream().filter(ann -> ann.getName().equals(DataObject.class.getName()))
    .findFirst().get();
  ClassTypeInfo cti = (ClassTypeInfo) abc.getMember("jsonPropertyNameFormatter");
  switch (cti.getName()) {
    case "io.vertx.codegen.format.CamelCase":
      return CamelCase.INSTANCE;
    case "io.vertx.codegen.format.SnakeCase":
      return SnakeCase.INSTANCE;
    case "io.vertx.codegen.format.LowerCamelCase":
      return LowerCamelCase.INSTANCE;
    default:
      throw new UnsupportedOperationException("Todo");
  }
}
 
Example #2
Source File: MapperGenBase.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
private Case getCase(DataObjectModel model, String name) {
  AnnotationValueInfo abc = getAnnotation(model).get();
  ClassTypeInfo cti = (ClassTypeInfo) abc.getMember(name);
  switch (cti.getName()) {
    case "io.vertx.codegen.format.CamelCase":
      return CamelCase.INSTANCE;
    case "io.vertx.codegen.format.SnakeCase":
      return SnakeCase.INSTANCE;
    case "io.vertx.codegen.format.LowerCamelCase":
      return LowerCamelCase.INSTANCE;
    default:
      throw new UnsupportedOperationException();
  }
}
 
Example #3
Source File: Lang.java    From vertx-codetrans with Apache License 2.0 5 votes vote down vote up
default File createSourceFile(File root, List<String> className, String methodName) {
  Stream.Builder<String> builder = Stream.builder();
  className.forEach(builder::add);
  if (methodName != null) {
    builder.add((methodName));
  }
  String t = builder
    .build()
    .map(s -> SnakeCase.INSTANCE.format(CamelCase.INSTANCE.parse(s)).replace('.', File.separatorChar))
    .collect(Collectors.joining(File.separator));
  return new File(root, t + "." + getExtension());
}
 
Example #4
Source File: CaseTest.java    From vertx-codegen with Apache License 2.0 5 votes vote down vote up
@Test
public void testConversion() {
  assertEquals("foo-bar-juu", CamelCase.INSTANCE.to(KebabCase.INSTANCE, "FooBarJuu"));
  assertEquals("foo_bar_juu", CamelCase.INSTANCE.to(SnakeCase.INSTANCE, "FooBarJuu"));
  assertEquals("FooBarJuu", SnakeCase.INSTANCE.to(CamelCase.INSTANCE, "foo_bar_juu"));
  assertEquals("FooBarJuu", KebabCase.INSTANCE.to(CamelCase.INSTANCE, "foo-bar-juu"));
}
 
Example #5
Source File: MethodInfo.java    From vertx-codegen with Apache License 2.0 4 votes vote down vote up
public String getName(Case _case) {
  return _case.format(CamelCase.INSTANCE.parse(name));
}
 
Example #6
Source File: ParamInfo.java    From vertx-codegen with Apache License 2.0 4 votes vote down vote up
public String getName(Case _case) {
  return _case.format(CamelCase.INSTANCE.parse(name));
}
 
Example #7
Source File: ClassTypeInfo.java    From vertx-codegen with Apache License 2.0 4 votes vote down vote up
public String getSimpleName(Case _case) {
  return _case.format(CamelCase.INSTANCE.parse(simpleName));
}
 
Example #8
Source File: CaseTest.java    From vertx-codegen with Apache License 2.0 4 votes vote down vote up
private void formatCamelCase(String expected, String... atoms) {
  assertCase(CamelCase.INSTANCE, expected, atoms);
}
 
Example #9
Source File: CaseTest.java    From vertx-codegen with Apache License 2.0 4 votes vote down vote up
private void parseCamelCase(String s, String... expected) {
  parseCase(CamelCase.INSTANCE, s, expected);
}