コード例 #1
0
  public String getJavaTypeName(final Type type, final boolean sequence, final JavaWriter writer) {
    final String typeName;
    if (type instanceof Message) {
      if (sequence) {
        typeName = writer.compressType(getSequenceTypeName(type.getCanonicalName()));
      } else {
        typeName = type.getCanonicalName();
      }
    } else if (type.isPrimitive()) {

      if (isEnumDeclaration(type)) {
        return Names.capitalize(type.getCanonicalName());
      }

      Class<?> clazz = getJavaClass(type);
      if (sequence) {
        String itemClassName = getSequenceItemClassName(clazz);
        typeName = writer.compressType(getSequenceTypeName(itemClassName));
      } else {
        typeName = writer.compressType(clazz.getCanonicalName());
      }
    } else {
      throw new UnsupportedOperationException(
          "Cannot resolve Java type for " + type + ", sequence: " + sequence);
    }
    return typeName;
  }
コード例 #2
0
 public String getName(final Descriptionable d) {
   String name = d.getCanonicalName();
   return isPrettifyNames() ? Names.prettifiedName(name) : name;
 }