Prints a type as either a ref type or a primitive

@param type Type to be printed
@return pretty string
179589
public static String print(Type type) {
        return type.match(new Type.MatchBlock<String>(){
            @Override
            public String _case(Ref x) {
                return print(x.type);
            }

            @Override
            public String _case(Primitive x) {
                return print(x.type);
            }
            
        });
    }
210276
public String getLiteralType(Type type) {
		String result = "";
		if (type != null) {
			if (ParameterizedType.class.isAssignableFrom(type.getClass())) {
				ParameterizedType parameterizedType = (ParameterizedType) type;
				result = parameterizedType.toString();
			} else {
				result = ((Class) type).getCanonicalName();
			}
		}
		return result;
	}
310630
private String getNameForType( Class<?> type )
    {
        if ( _typeToStringMap.containsKey( type ) )
        {
            return _typeToStringMap.get( type );
        }

        for ( Entry<String, Class<?>> entry : _typeMappings.entrySet() )
        {
            if ( entry.getValue().isAssignableFrom( type ) )
            {
                return entry.getKey();
            }
        }
        return null;
    }
762562
public static String getText(int type) {
        String text = "";

        if (TEXTS.containsKey(type)) {
            text = TEXTS.get(type);
        }

        return text;
    }
392905
private static TYPE toTYPE(String type) {
        if (null == type || type.trim().isEmpty()) {
            return TYPE.OBJECT;
        } else {
            return TYPE.valueOf(type.toUpperCase());
        }
    }
29075
protected Type getTypeForElement(@Nonnull TypedElement type) {
        Type propertyType;
        final Optional<Class> pt;
        final String typeName = type.getName();
        if (type.isPrimitive()) {
            if (type.isArray()) {
                pt = ClassUtils.arrayTypeForPrimitive(typeName);
            } else {
                pt = ClassUtils.getPrimitiveType(typeName);
            }
        } else {
            pt = Optional.empty();
        }
        if (pt.isPresent()) {
            propertyType = getTypeReference(pt.get());
        } else {
            if (type.isArray()) {
                propertyType = getTypeReference(typeName + "[]");
            } else {
                propertyType = getTypeReference(typeName);
            }
        }
        return propertyType;
    }
1188892
static String actualTypeParametersString(TypeElement type) {
    List<? extends TypeParameterElement> typeParameters = type.getTypeParameters();
    if (typeParameters.isEmpty()) {
      return "";
    } else {
      return typeParameters
          .stream()
          .map(e -> e.getSimpleName().toString())
          .collect(joining(", ", "<", ">"));
    }
  }
1190737
public static final String getString(Type type) {
        if (type instanceof GenericObjectType) {
            return ((GenericObjectType) type).toString(true);
        } else if (type instanceof ArrayType) {
            return TypeCategory.asString((ArrayType) type);
        } else {
            return type.toString();
        }
    }
565441
private String getTypeGenericName(Type type)
    {
        StringBuilder sb = new StringBuilder(getTypeName(type));

        if (type instanceof ParameterizedType) {
            ParameterizedType parameterizedType = (ParameterizedType) type;

            Type[] generics = parameterizedType.getActualTypeArguments();
            if (generics.length > 0) {
                sb.append('<');
                for (int i = 0; i < generics.length; ++i) {
                    if (i > 0) {
                        sb.append(',');
                    }
                    sb.append(getTypeGenericName(generics[i]));
                }
                sb.append('>');
            }
        }

        return sb.toString();
    }
372471
private static BaseTypeConverter lookupTypeConverter(Class type) {
        BaseTypeConverter converter = (BaseTypeConverter)TYPE_CONVERTERS.get(type);
        if(converter == null) {
            String msg = "Could not find a TypeConverter for converting a String to an object of type \"" +
                (type != null ? type.getName() : null) + "\"";
            TypeConverterNotFoundException tcn = new TypeConverterNotFoundException(msg);

            if(type == null)
                msg = Bundle.getErrorString("TypeUtils_nullType");
            else
                msg = Bundle.getErrorString("TypeUtils_noConverterForType", new Object[]{type.getName()});
            tcn.setLocalizedMessage(msg);
            LOGGER.error(msg);

            throw tcn;
        }

        return converter;
    }
274620
private JavaType toJavaType(Type type) {
		JavaType typeToFind;
    	if (type instanceof JavaType) {
    		typeToFind = (JavaType) type;
    	} else {
    		typeToFind = _mapper.constructType(type);
    	}
		return typeToFind;
	}
571655
private static String getSignature(TypeMirror type) {
        StringBuilder sbuf = new StringBuilder();
        type.accept(new SimpleTypeVisitor7<Void, StringBuilder>() {
            @Override
            protected Void defaultAction(TypeMirror e, StringBuilder stringBuilder) {
                return null;
            }

            @Override
            public Void visitPrimitive(PrimitiveType t, StringBuilder stringBuilder) {
                switch (t.getKind()) {
                    case BOOLEAN:
                        stringBuilder.append("Z");
                        break;
                    case BYTE:
                        stringBuilder.append("B");
                        break;
                    case CHAR:
                        stringBuilder.append("C");
                        break;
                    case DOUBLE:
                        stringBuilder.append("D");
                        break;
                    case FLOAT:
                        stringBuilder.append("F");
                        break;
                    case INT:
                        stringBuilder.append("I");
                        break;
                    case LONG:
                        stringBuilder.append("J");
                        break;
                    case SHORT:
                        stringBuilder.append("S");
                        break;
                    default:
                        break;
                }

                return null;
            }

            @Override
            public Void visitArray(ArrayType t, StringBuilder stringBuilder) {
                stringBuilder.append("[");
                t.getComponentType().accept(this, stringBuilder);
                return null;
            }

            @Override
            public Void visitDeclared(DeclaredType t, StringBuilder stringBuilder) {
                stringBuilder.append("L");
                stringBuilder.append(((TypeElement) t.asElement()).getQualifiedName().toString().replace('.', '/'));
                stringBuilder.append(";");

                return null;
            }

            @Override
            public Void visitExecutable(ExecutableType t, StringBuilder stringBuilder) {
                stringBuilder.append("(");
                for (TypeMirror p : t.getParameterTypes()) {
                    p.accept(this, stringBuilder);
                }
                stringBuilder.append(")");
                t.getReturnType().accept(this, stringBuilder);

                return null;
            }

            @Override
            public Void visitNoType(NoType t, StringBuilder stringBuilder) {
                if (t.getKind() == TypeKind.VOID) {
                    stringBuilder.append("V");
                }

                return null;
            }
        }, sbuf);

        return sbuf.toString();
    }
1177609
public static String getExample(TypeDeclaration type) {
		if (type == null || type.example() == null) {
			return null;
		} else {
			return type.example().value();
		}
	}
68626
public ClassName generatedTypeName(Type type) {
    ClassName abstractAdapterName = abstractAdapterName(type.type());
    return abstractAdapterName != null
        ? abstractAdapterName
        : (ClassName) typeName(type.type());
  }
23817
function toTypeRefName(Type) {
    var ref = toTypeRef(Type);
    return ref instanceof Function ? ref.name : ref;
  }
1130403
private final String toPrettyPrintedStack(String type)
    {
        StringBuffer result = new StringBuffer();
        StringBuffer spaces = new StringBuffer();
        result.append("Unable to serialize class: ");
        result.append(type);
        result.append("\nField hierarchy is:");
        for (Iterator<TraceSlot> i = traceStack.listIterator(); i.hasNext();)
        {
            spaces.append("  ");
            TraceSlot slot = i.next();
            result.append("\n").append(spaces).append(slot.fieldDescription);
            result.append(" [class=").append(slot.object.getClass().getName());
            if (slot.object instanceof Component)
            {
                Component component = (Component) slot.object;
                result.append(", path=").append(component.getPath());
            }
            result.append("]");
        }
        result.append(" <----- field that is not serializable");
        return result.toString();
    }
1066415
public static PrimitiveType checkIsPrimitiveType(Type type) {
        if (!isPrimitiveType(type)) {
            throw new ODataSystemException("A primitive type is required, but '" + type.getFullyQualifiedName() +
                    "' is not a primitive type: " + type.getMetaType());
        }
        return (PrimitiveType) type;
    }