1 16 package org.jmanage.core.management; 17 18 23 public class ObjectFeatureInfo implements java.io.Serializable { 24 25 protected String name; 26 protected String description; 27 28 public ObjectFeatureInfo(String name, String description) { 29 this.name = name; 30 this.description = description; 31 } 32 33 public String getDescription() { 34 if(description == null) 35 return ""; 36 return description; 37 } 38 39 public String getName() { 40 return name; 41 } 42 43 protected String getDisplayType(String type){ 44 if(type != null && type.startsWith("[")){ 45 47 String arrayBraces = ""; 48 while(type.startsWith("[")){ 49 type = type.substring(1); 50 arrayBraces += "[]"; 51 } 52 type = getArrayDisplayType(type) + arrayBraces; 53 } 54 return type; 55 } 56 57 76 private String getArrayDisplayType(String arrayType){ 77 String dataType; 78 if(arrayType.equals("Z")){ 79 dataType = "boolean"; 80 }else if(arrayType.equals("B")){ 81 dataType = "byte"; 82 }else if(arrayType.equals("C")){ 83 dataType = "char"; 84 }else if(arrayType.equals("D")){ 85 dataType = "double"; 86 }else if(arrayType.equals("F")){ 87 dataType = "float"; 88 }else if(arrayType.equals("I")){ 89 dataType = "int"; 90 }else if(arrayType.equals("J")){ 91 dataType = "long"; 92 }else if(arrayType.equals("S")){ 93 dataType = "short"; 94 }else if(arrayType.startsWith("L")){ 95 dataType = arrayType.substring(1, arrayType.length() - 1); 96 }else{ 97 throw new RuntimeException ("Invalid arrayType:" + arrayType); 98 } 99 return dataType; 100 } 101 } 102 | Popular Tags |