io.vertx.codegen.format.Case Java Examples

The following examples show how to use io.vertx.codegen.format.Case. 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: 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 #4
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 #5
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 #6
Source File: CaseTest.java    From vertx-codegen with Apache License 2.0 4 votes vote down vote up
private void assertCase(Case _case, String expected, String... atoms) {
  assertEquals(expected, _case.format(Arrays.asList(atoms)));
}
 
Example #7
Source File: CaseTest.java    From vertx-codegen with Apache License 2.0 4 votes vote down vote up
private void parseCase(Case _case, String s, String... expected) {
  assertEquals(Arrays.asList(expected), _case.parse(s));
}
 
Example #8
Source File: ModuleInfo.java    From vertx-codegen with Apache License 2.0 2 votes vote down vote up
/**
 * @param _case the formatting case
 * @return the module name in the specified case
 */
public String getName(Case _case) {
  return _case.format(KebabCase.INSTANCE.parse(name));
}