< prev index next >

src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java

Print this page




 144         result.append('(');
 145         boolean firstMember = true;
 146         for (Map.Entry<String, Object> e : memberValues.entrySet()) {
 147             if (firstMember)
 148                 firstMember = false;
 149             else
 150                 result.append(", ");
 151 
 152             result.append(e.getKey());
 153             result.append('=');
 154             result.append(memberValueToString(e.getValue()));
 155         }
 156         result.append(')');
 157         return result.toString();
 158     }
 159 
 160     /**
 161      * Translates a member value (in "dynamic proxy return form") into a string
 162      */
 163     private static String memberValueToString(Object value) {



 164         Class<?> type = value.getClass();
 165         if (!type.isArray())    // primitive, string, class, enum const,
 166                                 // or annotation
 167             return value.toString();
 168 
 169         if (type == byte[].class)
 170             return Arrays.toString((byte[]) value);
 171         if (type == char[].class)
 172             return Arrays.toString((char[]) value);
 173         if (type == double[].class)
 174             return Arrays.toString((double[]) value);
 175         if (type == float[].class)
 176             return Arrays.toString((float[]) value);
 177         if (type == int[].class)
 178             return Arrays.toString((int[]) value);
 179         if (type == long[].class)
 180             return Arrays.toString((long[]) value);
 181         if (type == short[].class)
 182             return Arrays.toString((short[]) value);
 183         if (type == boolean[].class)




 144         result.append('(');
 145         boolean firstMember = true;
 146         for (Map.Entry<String, Object> e : memberValues.entrySet()) {
 147             if (firstMember)
 148                 firstMember = false;
 149             else
 150                 result.append(", ");
 151 
 152             result.append(e.getKey());
 153             result.append('=');
 154             result.append(memberValueToString(e.getValue()));
 155         }
 156         result.append(')');
 157         return result.toString();
 158     }
 159 
 160     /**
 161      * Translates a member value (in "dynamic proxy return form") into a string
 162      */
 163     private static String memberValueToString(Object value) {
 164         if (value instanceof ExceptionProxy) {
 165             return ((ExceptionProxy)value).memberToString();
 166         }
 167         Class<?> type = value.getClass();
 168         if (!type.isArray())    // primitive, string, class, enum const,
 169                                 // or annotation
 170             return value.toString();
 171 
 172         if (type == byte[].class)
 173             return Arrays.toString((byte[]) value);
 174         if (type == char[].class)
 175             return Arrays.toString((char[]) value);
 176         if (type == double[].class)
 177             return Arrays.toString((double[]) value);
 178         if (type == float[].class)
 179             return Arrays.toString((float[]) value);
 180         if (type == int[].class)
 181             return Arrays.toString((int[]) value);
 182         if (type == long[].class)
 183             return Arrays.toString((long[]) value);
 184         if (type == short[].class)
 185             return Arrays.toString((short[]) value);
 186         if (type == boolean[].class)


< prev index next >