getPackageToNamespaceMappings().put(packageName, namespaceInfo);
}
String name = componentClass.getName();
Type componentType = Type.getType("L" + componentClass.getName().replace('.', '/') + ";");
String componentTypeInternalName = null;
if (name.equals("[B")) {
name = "byteArray";
componentTypeInternalName = componentType.getInternalName();
} else if (name.equals("[Ljava.lang.Byte;")) {
name = "ByteArray";
componentTypeInternalName = componentType.getInternalName() + ";";
} else {
componentTypeInternalName = "L" + componentType.getInternalName() + ";";
}
int beginIndex = name.lastIndexOf('.') + 1;
name = name.substring(beginIndex);
int dollarIndex = name.indexOf('$');
if (dollarIndex > -1) {
name = name.substring(dollarIndex + 1);
}
String collectionClassRawName = collectionClass.getRawName();
String collectionClassShortName = collectionClassRawName.substring(collectionClassRawName.lastIndexOf('.') + 1);
String suggestedClassName = collectionClassShortName + "Of" + name;
String qualifiedClassName = packageName + "." + suggestedClassName;
qualifiedClassName = getNextAvailableClassName(qualifiedClassName);
String className = qualifiedClassName.substring(qualifiedClassName.lastIndexOf('.') + 1);
Type collectionType = Type.getType("L" + collectionClassRawName.replace('.', '/') + ";");
String qualifiedInternalClassName = qualifiedClassName.replace('.', '/');
ClassWriter cw = new ClassWriter(false);
CodeVisitor cv;
cw.visit(Constants.V1_5, Constants.ACC_PUBLIC + Constants.ACC_SUPER, qualifiedInternalClassName, "org/eclipse/persistence/internal/jaxb/many/CollectionValue", null, className.replace('.', '/') + ".java");
// FIELD ATTRIBUTES
RuntimeVisibleAnnotations fieldAttrs1 = new RuntimeVisibleAnnotations();
if (typeMappingInfo != null) {
java.lang.annotation.Annotation[] annotations = getAnnotations(typeMappingInfo);
if (annotations != null) {
for (int i = 0; i < annotations.length; i++) {
java.lang.annotation.Annotation nextAnnotation = annotations[i];
if (nextAnnotation != null && !(nextAnnotation instanceof XmlElement) && !(nextAnnotation instanceof XmlJavaTypeAdapter)) {
String annotationClassName = nextAnnotation.annotationType().getName();
Annotation fieldAttrs1ann0 = new Annotation("L" + annotationClassName.replace('.', '/') + ";");
fieldAttrs1.annotations.add(fieldAttrs1ann0);
for (Method next : nextAnnotation.annotationType().getDeclaredMethods()) {
try {
Object nextValue = next.invoke(nextAnnotation, new Object[] {});
if (nextValue instanceof Class) {
Type nextType = Type.getType("L" + ((Class) nextValue).getName().replace('.', '/') + ";");
nextValue = nextType;
}
fieldAttrs1ann0.add(next.getName(), nextValue);
} catch (InvocationTargetException ex) {
// ignore the invocation target exception here.