48 * @return a generic array type with the desired component type
49 */
50 public static GenericArrayTypeImpl make(Type ct) {
51 return new GenericArrayTypeImpl(ct);
52 }
53
54
55 /**
56 * Returns a {@code Type} object representing the component type
57 * of this array.
58 *
59 * @return a {@code Type} object representing the component type
60 * of this array
61 * @since 1.5
62 */
63 public Type getGenericComponentType() {
64 return genericComponentType; // return cached component type
65 }
66
67 public String toString() {
68 Type componentType = getGenericComponentType();
69 StringBuilder sb = new StringBuilder();
70
71 if (componentType instanceof Class)
72 sb.append(((Class)componentType).getName() );
73 else
74 sb.append(componentType.toString());
75 sb.append("[]");
76 return sb.toString();
77 }
78
79 @Override
80 public boolean equals(Object o) {
81 if (o instanceof GenericArrayType) {
82 GenericArrayType that = (GenericArrayType) o;
83
84 return Objects.equals(genericComponentType, that.getGenericComponentType());
85 } else
86 return false;
87 }
88
89 @Override
90 public int hashCode() {
91 return Objects.hashCode(genericComponentType);
92 }
93 }
|
48 * @return a generic array type with the desired component type
49 */
50 public static GenericArrayTypeImpl make(Type ct) {
51 return new GenericArrayTypeImpl(ct);
52 }
53
54
55 /**
56 * Returns a {@code Type} object representing the component type
57 * of this array.
58 *
59 * @return a {@code Type} object representing the component type
60 * of this array
61 * @since 1.5
62 */
63 public Type getGenericComponentType() {
64 return genericComponentType; // return cached component type
65 }
66
67 public String toString() {
68 StringBuilder sb = new StringBuilder();
69 sb.append(getGenericComponentType().getTypeName());
70 sb.append("[]");
71 return sb.toString();
72 }
73
74 @Override
75 public boolean equals(Object o) {
76 if (o instanceof GenericArrayType) {
77 GenericArrayType that = (GenericArrayType) o;
78
79 return Objects.equals(genericComponentType, that.getGenericComponentType());
80 } else
81 return false;
82 }
83
84 @Override
85 public int hashCode() {
86 return Objects.hashCode(genericComponentType);
87 }
88 }
|