code: public static boolean isJavaConstantType(TypeMirror type)
      {
          switch (type.getKind())
          {
              case INT:
              case LONG:
              case FLOAT:
              case DOUBLE:
                  return true;
              case DECLARED:
                  DeclaredType dt = (DeclaredType) type;
                  TypeElement te = (TypeElement) dt.asElement();
                  return "java.lang.String".contentEquals(te.getQualifiedName());
              default:
                  return false;
          }
      }
docs: Returns true if type is one of int, long, float, double or java.lang.String
  @param type
  @return