1 package org.sapia.util.xml.idefix.serializer; 2 3 4 14 public class SerializerHelper { 15 21 public static String getLocalClassName(Object anObject) { 22 if (anObject == null) { 23 return ""; 24 } 25 26 Class aClass = anObject.getClass(); 27 28 String aQualifiedClassName = aClass.getName(); 29 String aPackageName = aClass.getPackage().getName(); 30 String aLocalClassName = aQualifiedClassName.substring(aPackageName.length() + 31 1); 32 33 return aLocalClassName; 34 } 35 36 46 public static String firstToLowerFromIndex(String aString, int aStartingIndex) { 47 if (aStartingIndex < 0) { 48 throw new IllegalArgumentException ( 49 "The starting position is lower than zero"); 50 } 51 52 char[] newChars = new char[aString.length() - aStartingIndex]; 53 newChars[0] = Character.toLowerCase(aString.charAt(aStartingIndex)); 54 aString.getChars(aStartingIndex + 1, aString.length(), newChars, 1); 55 56 return new String (newChars); 57 } 58 59 69 public static String firstToUpperFromIndex(String aString, int aStartingIndex) { 70 if (aStartingIndex < 0) { 71 throw new IllegalArgumentException ( 72 "The starting position is lower than zero"); 73 } 74 75 char[] newChars = new char[aString.length() - aStartingIndex]; 76 newChars[0] = Character.toUpperCase(aString.charAt(aStartingIndex)); 77 aString.getChars(aStartingIndex + 1, aString.length(), newChars, 1); 78 79 return new String (newChars); 80 } 81 } 82 | Popular Tags |