Here you can find the source of convertArrayTypeName(final String typeName)
Parameter | Description |
---|---|
typeName | is type name |
public static String convertArrayTypeName(final String typeName)
//package com.java2s; /************************************************************************************** * Copyright (c) Jonas Bon?r, Alexandre Vasseur. All rights reserved. * * http://aspectwerkz.codehaus.org * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the LGPL license * * a copy of which has been included with this distribution in the license.txt file. * **************************************************************************************/ public class Main { /**/*from w ww .j a va 2s . com*/ * Converts an internal Java array type name ([Lblabla) to the a the format used by the expression matcher * (blabla[]) * * @param typeName is type name * @return */ public static String convertArrayTypeName(final String typeName) { int index = typeName.lastIndexOf('['); if (index != -1) { StringBuffer arrayType = new StringBuffer(); if (typeName.endsWith("I")) { arrayType.append("int"); } else if (typeName.endsWith("J")) { arrayType.append("long"); } else if (typeName.endsWith("S")) { arrayType.append("short"); } else if (typeName.endsWith("F")) { arrayType.append("float"); } else if (typeName.endsWith("D")) { arrayType.append("double"); } else if (typeName.endsWith("Z")) { arrayType.append("boolean"); } else if (typeName.endsWith("C")) { arrayType.append("char"); } else if (typeName.endsWith("B")) { arrayType.append("byte"); } else { arrayType.append(typeName.substring(index + 2, typeName.length() - 1)); } for (int i = 0; i < (index + 1); i++) { arrayType.append("[]"); } return arrayType.toString(); } else { return typeName; } } }