diff options
author | Jesse Wilson <jesse@swank.ca> | 2015-10-23 20:19:24 -0400 |
---|---|---|
committer | Jesse Wilson <jesse@swank.ca> | 2015-10-23 20:19:24 -0400 |
commit | 3bdc6b5c3faa4884684fd0b7ab2457e4bb7e45ff (patch) | |
tree | 3da5964714cc5a6f8084941646f2ee7b93f9c685 /src/main/java/com/squareup/javapoet | |
parent | 852b1bb78224e2fd3a183b6175e388044d775ae1 (diff) | |
parent | 43db56716e85504cdcb8c0f3652b53c2fef3c506 (diff) | |
download | javapoet-3bdc6b5c3faa4884684fd0b7ab2457e4bb7e45ff.tar.gz |
Merge pull request #358 from square/jwilson_1023_rollback
Revert "AnnotationTypeName added."
Diffstat (limited to 'src/main/java/com/squareup/javapoet')
-rw-r--r-- | src/main/java/com/squareup/javapoet/AnnotatedTypeName.java | 57 | ||||
-rw-r--r-- | src/main/java/com/squareup/javapoet/TypeName.java | 10 |
2 files changed, 0 insertions, 67 deletions
diff --git a/src/main/java/com/squareup/javapoet/AnnotatedTypeName.java b/src/main/java/com/squareup/javapoet/AnnotatedTypeName.java deleted file mode 100644 index e10d876..0000000 --- a/src/main/java/com/squareup/javapoet/AnnotatedTypeName.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2015 Square, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.squareup.javapoet; - -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public final class AnnotatedTypeName extends TypeName { - - public static AnnotatedTypeName get(TypeName type, AnnotationSpec... annotations) { - return new AnnotatedTypeName(type, Arrays.asList(annotations)); - } - - public static AnnotatedTypeName get(Type type, Annotation... annotations) { - List<AnnotationSpec> specs = new ArrayList<>(); - for (int i = 0; i < annotations.length; i++) { - specs.add(AnnotationSpec.get(annotations[i])); - } - return new AnnotatedTypeName(TypeName.get(type), specs); - } - - public final TypeName type; - public final List<AnnotationSpec> annotations; - - AnnotatedTypeName(TypeName type, List<AnnotationSpec> annotations) { - this.type = type; - this.annotations = Util.immutableList(annotations); - } - - @Override CodeWriter emit(CodeWriter out) throws IOException { - if (!annotations.isEmpty()) { - for (AnnotationSpec annotation : annotations) { - annotation.emit(out, true); - out.emit(" "); - } - } - return type.emit(out); - } - -} diff --git a/src/main/java/com/squareup/javapoet/TypeName.java b/src/main/java/com/squareup/javapoet/TypeName.java index 2f8114a..8ee2772 100644 --- a/src/main/java/com/squareup/javapoet/TypeName.java +++ b/src/main/java/com/squareup/javapoet/TypeName.java @@ -22,7 +22,6 @@ import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.lang.reflect.WildcardType; import java.util.ArrayList; -import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -98,15 +97,6 @@ public class TypeName { this(null); } - public AnnotatedTypeName annotated(AnnotationSpec... annotations) { - return new AnnotatedTypeName(this, Arrays.asList(annotations)); - } - - public ParameterizedTypeName parameterized(TypeName... parameters) { - Util.checkState(this instanceof ClassName, "expected to be a ClassName, but am " + this); - return new ParameterizedTypeName((ClassName) this, Arrays.asList(parameters)); - } - public boolean isPrimitive() { return keyword != null && this != VOID; } |