OPENJPA-2662 reimplement serp.util.Strings#getClassName

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1759355 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Struberg 2016-09-05 20:35:11 +00:00
parent da6ea0f708
commit 297190a43a
23 changed files with 171 additions and 52 deletions

View File

@ -39,6 +39,8 @@ import org.apache.openjpa.lib.conf.Configurable;
import org.apache.openjpa.lib.conf.Configuration;
import org.apache.openjpa.lib.conf.Configurations;
import org.apache.openjpa.lib.identifier.IdentifierUtil;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.StringUtil;
import org.apache.openjpa.meta.JavaTypes;
import serp.util.Strings;
@ -547,8 +549,7 @@ public class MappingDefaultsImpl
// WARNING: CHANGING THIS WILL INVALIDATE EXISTING DATA IF DEFAULTING
// MISSING MAPPING INFO
String alias = Strings.getClassName(disc.getClassMapping()
.getTypeAlias());
String alias = ClassUtil.getClassName(disc.getClassMapping().getTypeAlias());
switch (disc.getJavaType()) {
case JavaTypes.INT:
@ -562,7 +563,7 @@ public class MappingDefaultsImpl
}
public String getTableName(ClassMapping cls, Schema schema) {
String name = Strings.getClassName(cls.getDescribedType()).
String name = ClassUtil.getClassName(cls.getDescribedType()).
replace(IdentifierUtil.DOLLAR_CHAR, IdentifierUtil.UNDERSCORE_CHAR);
if (!_defMissing)
name = dict.getValidTableName(name, schema);

View File

@ -41,6 +41,7 @@ import org.apache.openjpa.jdbc.schema.Table;
import org.apache.openjpa.jdbc.schema.Unique;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.lib.log.Log;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.lib.util.Localizer.Message;
import org.apache.openjpa.meta.JavaTypes;
@ -1600,7 +1601,7 @@ public abstract class MappingInfo
if (cls == null)
return false;
if (name.equals(cls.getDescribedType().getName())
|| name.equals(Strings.getClassName(cls.getDescribedType())))
|| name.equals(ClassUtil.getClassName(cls.getDescribedType())))
return true;
return isClassMappingName(name, cls.getPCSuperclassMapping());
}

View File

@ -26,6 +26,7 @@ import org.apache.openjpa.jdbc.schema.Schema;
import org.apache.openjpa.jdbc.schema.Table;
import org.apache.openjpa.jdbc.schema.Unique;
import org.apache.openjpa.lib.util.ClassUtil;
import serp.util.Strings;
/**
@ -72,7 +73,7 @@ public class NoneMappingDefaults
}
public String getTableName(ClassMapping cls, Schema schema) {
return Strings.getClassName(cls.getDescribedType()).replace('$', '_');
return ClassUtil.getClassName(cls.getDescribedType()).replace('$', '_');
}
public String getTableName(FieldMapping fm, Schema schema) {

View File

@ -43,6 +43,7 @@ import org.apache.openjpa.lib.conf.Configuration;
import org.apache.openjpa.lib.conf.Configurations;
import org.apache.openjpa.lib.log.Log;
import org.apache.openjpa.lib.meta.ClassArgParser;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.CodeFormat;
import org.apache.openjpa.lib.util.Files;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
@ -264,7 +265,7 @@ public class ApplicationIdTool {
return null;
// convert from SomeClass$ID to ID
String className = Strings.getClassName(_meta.getObjectIdType());
String className = ClassUtil.getClassName(_meta.getObjectIdType());
if (isInnerClass())
className = className.substring(className.lastIndexOf('$') + 1);
return className;
@ -358,7 +359,7 @@ public class ApplicationIdTool {
code.endl().tab();
if (superOidClass != null) {
code.append("extends " + Strings.getClassName(superOidClass));
code.append("extends " + ClassUtil.getClassName(superOidClass));
if (code.getBraceOnSameLine())
code.append(" ");
else
@ -541,7 +542,7 @@ public class ApplicationIdTool {
return "char[]";
if (type.getName().startsWith("java.sql."))
return type.getName();
return Strings.getClassName(type);
return ClassUtil.getClassName(type);
}
/**
@ -712,7 +713,7 @@ public class ApplicationIdTool {
else if (type == char[].class)
parse.append(var).append(".toCharArray").parens();
else if (!type.isPrimitive()) {
parse.append("new ").append(Strings.getClassName(type)).
parse.append("new ").append(ClassUtil.getClassName(type)).
openParen(true).append(var).closeParen();
} else // primitive
{
@ -1214,7 +1215,7 @@ public class ApplicationIdTool {
return null;
String packageName = Strings.getPackageName(_meta.getObjectIdType());
String fileName = Strings.getClassName(_meta.getObjectIdType())
String fileName = ClassUtil.getClassName(_meta.getObjectIdType())
+ ".java";
// if pc class in same package as oid class, try to find pc .java file

View File

@ -28,6 +28,7 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.conf.OpenJPAConfiguration;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.CodeFormat;
import org.apache.openjpa.lib.util.Files;
import org.apache.openjpa.lib.util.ParameterTemplate;
@ -126,7 +127,7 @@ public class CodeGenerator {
*/
public void generateCode() {
// setup parameters
String className = Strings.getClassName(_type);
String className = ClassUtil.getClassName(_type);
String packageName = Strings.getPackageName(_type);
String packageDec = "";
if (packageName.length() > 0)
@ -135,7 +136,7 @@ public class CodeGenerator {
String extendsDec = "";
String extendsName = "";
if (!_type.getSuperclass().getName().equals(Object.class.getName())) {
extendsName = Strings.getClassName(_type.getSuperclass());
extendsName = ClassUtil.getClassName(_type.getSuperclass());
extendsDec = "extends " + extendsName;
}
@ -235,7 +236,7 @@ public class CodeGenerator {
CodeFormat body = newCodeFormat();
// public <class> (
cons.tab().append("public ").append(Strings.getClassName(_type));
cons.tab().append("public ").append(ClassUtil.getClassName(_type));
cons.openParen(true);
// append args to constructor, and build up body at same time
@ -245,7 +246,7 @@ public class CodeGenerator {
propertyName = fields[i].getName();
if (propertyName.startsWith("_"))
propertyName = propertyName.substring(1);
fieldType = Strings.getClassName(fields[i].getDeclaredType());
fieldType = ClassUtil.getClassName(fields[i].getDeclaredType());
if (i > 0)
cons.append(", ");
@ -305,7 +306,7 @@ public class CodeGenerator {
String propertyName = fieldName;
if (propertyName.startsWith("_"))
propertyName = propertyName.substring(1);
String fieldType = Strings.getClassName(fmd.getDeclaredType());
String fieldType = ClassUtil.getClassName(fmd.getDeclaredType());
String keyType = null;
String elementType = null;
@ -313,14 +314,14 @@ public class CodeGenerator {
if (useGenericCollections()) {
if (fmd.getDeclaredTypeCode() == JavaTypes.COLLECTION) {
Class elmCls = fmd.getElement().getDeclaredType();
elementType = Strings.getClassName(elmCls);
elementType = ClassUtil.getClassName(elmCls);
paramType = decs.getParametrizedType(
new String[] {elementType});
} else if (fmd.getDeclaredTypeCode() == JavaTypes.MAP) {
Class keyCls = fmd.getKey().getDeclaredType();
Class elmCls = fmd.getElement().getDeclaredType();
keyType = Strings.getClassName(keyCls);
elementType = Strings.getClassName(elmCls);
keyType = ClassUtil.getClassName(keyCls);
elementType = ClassUtil.getClassName(elmCls);
paramType = decs.getParametrizedType(
new String[] {keyType, elementType});
}
@ -504,7 +505,7 @@ public class CodeGenerator {
*/
public File getFile() {
String packageName = Strings.getPackageName(_type);
String fileName = Strings.getClassName(_type) + ".java";
String fileName = ClassUtil.getClassName(_type) + ".java";
File dir = Files.getPackageFile(_dir, packageName, true);
return new File(dir, fileName);

View File

@ -1509,7 +1509,7 @@ public class QueryImpl
try {
String alias = compileForExecutor().getAlias(_storeQuery);
if (alias == null)
alias = Strings.getClassName(_class);
alias = ClassUtil.getClassName(_class);
return alias;
} finally {
unlock();

View File

@ -47,6 +47,7 @@ import org.apache.openjpa.lib.conf.Value;
import org.apache.openjpa.lib.conf.ValueListener;
import org.apache.openjpa.lib.log.Log;
import org.apache.openjpa.lib.meta.SourceTracker;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.lib.xml.Commentable;
@ -70,7 +71,6 @@ import org.apache.openjpa.util.ShortId;
import org.apache.openjpa.util.StringId;
import org.apache.openjpa.util.UnsupportedException;
import serp.util.Strings;
/**
* Contains metadata about a persistent type.
@ -686,7 +686,7 @@ public class ClassMetaData
*/
public String getTypeAlias() {
if (_alias == null)
_alias = Strings.getClassName(_type);
_alias = ClassUtil.getClassName(_type);
return _alias;
}
@ -1523,7 +1523,7 @@ public class ClassMetaData
/**
* Set the cache name for this class.
*
* @param can be null to disable cache.
* @param name can be {@code null} to disable cache.
*/
public void setDataCacheName(String name) {
_cacheName = name;

View File

@ -52,6 +52,7 @@ import org.apache.openjpa.kernel.OpenJPAStateManager;
import org.apache.openjpa.kernel.StoreContext;
import org.apache.openjpa.lib.conf.Configurations;
import org.apache.openjpa.lib.log.Log;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
import org.apache.openjpa.lib.util.JavaVersions;
import org.apache.openjpa.lib.util.Localizer;
@ -1626,7 +1627,7 @@ public class FieldMetaData
// get class name and get package name divide on the last '.', so the
// names don't apply in this case, but the methods do what we want
String methodName = Strings.getClassName(method);
String methodName = ClassUtil.getClassName(method);
String clsName = Strings.getPackageName(method);
Class<?> cls = null;
@ -1635,7 +1636,7 @@ public class FieldMetaData
if (clsName.length() == 0)
cls = getDeclaredType();
else if (clsName.equals(owner.getName())
|| clsName.equals(Strings.getClassName(owner)))
|| clsName.equals(ClassUtil.getClassName(owner)))
cls = owner;
else
cls = JavaTypes.classForName(clsName, this);

View File

@ -20,6 +20,7 @@ package org.apache.openjpa.ee;
import junit.framework.TestCase;
import org.apache.openjpa.lib.util.ClassUtil;
import serp.util.Strings;
/**
@ -47,8 +48,7 @@ public class TestWASManagedRuntime extends TestCase {
} catch (NoClassDefFoundError e) {
msg = e.getMessage();
}
String interfaceName = Strings.
getClassName(WASManagedRuntime.INTERFACE);
String interfaceName = ClassUtil.getClassName(WASManagedRuntime.INTERFACE);
assertTrue("message should have contained "
+ interfaceName + ", but was '" + msg + "'",
msg.indexOf(interfaceName) != -1);

View File

@ -159,6 +159,6 @@ public class DelegatingDataSource implements DataSource, Closeable {
// Java 7 methods follow
public Logger getParentLogger() throws SQLFeatureNotSupportedException{
throw new SQLFeatureNotSupportedException();
return _ds.getParentLogger();
}
}

View File

@ -31,6 +31,7 @@ import java.util.Enumeration;
import java.util.List;
import java.util.NoSuchElementException;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
import org.apache.openjpa.lib.util.MultiClassLoader;
import serp.util.Strings;
@ -129,7 +130,7 @@ public class ClassMetaDataIterator implements MetaDataIterator {
_locs.add(path + pkgName + suffix); // legacy
_locs.add(upPath + pkgName + suffix); // legacy
if (idx == -1)
_locs.add(path + Strings.getClassName(cls) + suffix);
_locs.add(path + ClassUtil.getClassName(cls) + suffix);
start = idx + 1;
upPath = path;

View File

@ -22,6 +22,7 @@ package org.apache.openjpa.lib.util;
*/
public final class ClassUtil {
private static final Object[][] _codes = new Object[][]{
{byte.class, "byte", "B"},
{char.class, "char", "C"},
@ -105,9 +106,68 @@ public final class ClassUtil {
try {
return Class.forName(str, resolve, loader);
} catch (ClassNotFoundException | NoClassDefFoundError e) {
}
catch (ClassNotFoundException | NoClassDefFoundError e) {
throw new IllegalArgumentException(e.getMessage());
}
}
}
/**
* Return only the class name, without package.
*/
public static String getClassName(Class cls) {
if (cls == null) {
return null;
}
return getClassName(cls.getName());
}
/**
* Return only the class name.
*/
public static String getClassName(String fullName) {
if (fullName == null) {
return null;
}
if (fullName.isEmpty()) {
return fullName;
}
int dims = 0;
while (fullName.charAt(dims) == '[') {
dims++;
}
if (dims > 0) {
if (fullName.length() == dims + 1) {
String classCode = fullName.substring(dims);
for (int i = 0; i < _codes.length; i++) {
if (_codes[i][2].equals(classCode)) {
fullName = (String)_codes[i][1];
break;
}
}
}
else {
if (fullName.charAt(fullName.length()-1) == ';') {
fullName = fullName.substring(dims + 1, fullName.length() - 1);
}
else {
fullName = fullName.substring(dims + 1);
}
}
}
int lastDot = fullName.lastIndexOf('.');
String simpleName = lastDot > -1 ? fullName.substring(lastDot + 1) : fullName;
if (dims > 0) {
StringBuilder sb = new StringBuilder(simpleName.length() + dims * 2);
sb.append(simpleName);
for (int i = 0; i < dims; i++) {
sb.append("[]");
}
simpleName = sb.toString();
}
return simpleName;
}
}

View File

@ -125,7 +125,7 @@ public class Files {
* Return the file for the class resource with the given extension.
*/
private static File getClassFile(Class cls, String ext) {
String name = Strings.getClassName(cls);
String name = ClassUtil.getClassName(cls);
// if it's an inner class, use the parent class name
int innerIdx = name.indexOf('$');

View File

@ -16,8 +16,12 @@
*/
package org.apache.openjpa.lib.util;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import serp.util.Strings;
public class ClassUtilTest {
@ -53,4 +57,54 @@ public class ClassUtilTest {
return ClassUtil.toClass(clazz, false, this.getClass().getClassLoader());
}
@Test
public void testGetClassName() {
Assert.assertEquals("ClassUtilTest", ClassUtil.getClassName(ClassUtilTest.class));
Assert.assertEquals("ClassUtilTest$MyInnerClass", ClassUtil.getClassName(MyInnerClass.class));
// anonymous class
Assert.assertEquals("ClassUtilTest$1", ClassUtil.getClassName(INSTANCE.getClass()));
// primitives
Assert.assertEquals("byte", ClassUtil.getClassName(byte.class));
Assert.assertEquals("char", ClassUtil.getClassName(char.class));
Assert.assertEquals("double", ClassUtil.getClassName(double.class));
Assert.assertEquals("float", ClassUtil.getClassName(float.class));
Assert.assertEquals("int", ClassUtil.getClassName(int.class));
Assert.assertEquals("long", ClassUtil.getClassName(long.class));
Assert.assertEquals("short", ClassUtil.getClassName(short.class));
Assert.assertEquals("boolean", ClassUtil.getClassName(boolean.class));
Assert.assertEquals("void", ClassUtil.getClassName(void.class));
// arrays
Assert.assertEquals("long[]", ClassUtil.getClassName(long[].class));
Assert.assertEquals("long[][]", ClassUtil.getClassName(long[][].class));
Assert.assertEquals("float[][][]", ClassUtil.getClassName(float[][][].class));
Assert.assertEquals("ClassUtilTest[]", ClassUtil.getClassName(ClassUtilTest[].class));
Assert.assertEquals("ClassUtilTest$MyInnerClass[]", ClassUtil.getClassName(MyInnerClass[].class));
Assert.assertEquals("ClassUtilTest$MyInnerClass[][]", ClassUtil.getClassName(MyInnerClass[][].class));
}
@Test
@Ignore("only needed for manual performance tests")
public void testGetClassNamePerformance() {
long start = System.nanoTime();
for (int i = 1; i < 10000000; i++) {
//X String className = Strings.getClassName(MyInnerClass.class);
ClassUtil.getClassName(MyInnerClass.class);
}
long stop = System.nanoTime();
System.out.println("took: " + TimeUnit.NANOSECONDS.toMillis(stop - start));
}
private static abstract class MyInnerClass {
// not needed
}
private static final MyInnerClass INSTANCE = new MyInnerClass() {
};
}

View File

@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import serp.util.Strings;
public class StringUtilTest {

View File

@ -18,6 +18,7 @@
*/
package org.apache.openjpa.persistence.jdbc;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.persistence.AnnotationPersistenceMetaDataSerializer;
import org.apache.openjpa.persistence.PersistenceStrategy;
import org.apache.openjpa.persistence.AnnotationBuilder;
@ -80,7 +81,6 @@ import javax.persistence.EntityResult;
import javax.persistence.FieldResult;
import javax.persistence.ColumnResult;
//@todo: javadocs
/**
* Serializes persistence mappings as annotations.
@ -220,8 +220,7 @@ public class AnnotationPersistenceMappingSerializer
ClassMapping cls = (ClassMapping) mapping;
ClassMappingInfo info = cls.getMappingInfo();
AnnotationBuilder abTable = addAnnotation(Table.class, mapping);
serializeTable(info.getTableName(), Strings
.getClassName(mapping.getDescribedType()), null,
serializeTable(info.getTableName(), ClassUtil.getClassName(mapping.getDescribedType()), null,
info.getUniques(info.getTableName()), abTable);
serializeColumns(info, ColType.PK_JOIN, null, abTable, cls);
for (String second : info.getSecondaryTableNames()) {
@ -241,7 +240,7 @@ public class AnnotationPersistenceMappingSerializer
String strat = info.getHierarchyStrategy();
if (null == strat)
return;
String itypecls = Strings.getClassName(InheritanceType.class);
String itypecls = ClassUtil.getClassName(InheritanceType.class);
AnnotationBuilder abInheritance =
addAnnotation(Inheritance.class, mapping);
if (FlatClassStrategy.ALIAS.equals(strat))

View File

@ -39,6 +39,7 @@ import org.apache.openjpa.jdbc.schema.Column;
import org.apache.openjpa.jdbc.schema.Schema;
import org.apache.openjpa.jdbc.schema.Table;
import org.apache.openjpa.jdbc.sql.JoinSyntaxes;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.meta.FieldMetaData;
import org.apache.openjpa.meta.JavaTypes;
import serp.util.Strings;
@ -127,7 +128,7 @@ public class PersistenceMappingDefaults
public String getTableName(ClassMapping cls, Schema schema) {
if (cls.getTypeAlias() != null)
return cls.getTypeAlias();
return Strings.getClassName(cls.getDescribedType()).replace('$', '_');
return ClassUtil.getClassName(cls.getDescribedType()).replace('$', '_');
}
@Override

View File

@ -29,6 +29,7 @@ import javax.persistence.EnumType;
import javax.persistence.TemporalType;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.lib.util.ClassUtil;
import org.xml.sax.SAXException;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.meta.ClassMapping;
@ -56,7 +57,6 @@ import org.apache.openjpa.meta.MetaDataRepository;
import org.apache.openjpa.meta.SequenceMetaData;
import org.apache.openjpa.persistence.PersistenceStrategy;
import org.apache.openjpa.persistence.XMLPersistenceMetaDataSerializer;
import serp.util.Strings;
/**
* Serializes persistence mapping to XML.
@ -184,8 +184,7 @@ public class XMLPersistenceMappingSerializer
throws SAXException {
ClassMapping cls = (ClassMapping) mapping;
ClassMappingInfo info = cls.getMappingInfo();
serializeTable(info.getTableName(), "table", Strings
.getClassName(mapping.getDescribedType()), null,
serializeTable(info.getTableName(), "table", ClassUtil.getClassName(mapping.getDescribedType()), null,
info.getUniques(info.getTableName()));
for (String second : info.getSecondaryTableNames())
serializeTable(second, "secondary-table", null, info,

View File

@ -30,7 +30,7 @@ public class HorizAppMultiA
// initialize PK values to random values
//FIXME
/*
private String pk1 = "PK-" + Strings.getClassName(getClass().getName());
private String pk1 = "PK-" + ClassUtil.getClassName(getClass().getName());
private int pk2 = com.solarmetric.test.AbstractTestCase.
randomInt().intValue();
*/

View File

@ -30,7 +30,7 @@ public class HorizAppSingleA
// initialize PK values to random values
//FIXME
/*
private String pk1 = "PK-" + Strings.getClassName(getClass().getName());
private String pk1 = "PK-" + ClassUtil.getClassName(getClass().getName());
private int pk2 = com.solarmetric.test.AbstractTestCase.
randomInt().intValue();
*/

View File

@ -18,7 +18,7 @@
*/
package org.apache.openjpa.persistence;
import serp.util.Strings;
import org.apache.openjpa.lib.util.ClassUtil;
import java.util.List;
import java.util.ArrayList;
@ -117,7 +117,7 @@ public class AnnotationBuilder {
static String enumToString(Enum e) {
StringBuilder sb = new StringBuilder();
sb.append(Strings.getClassName(e.getClass())).
sb.append(ClassUtil.getClassName(e.getClass())).
append(".").append(e);
return sb.toString();
}
@ -126,7 +126,7 @@ public class AnnotationBuilder {
StringBuilder sb = new StringBuilder();
for (Iterator i = set.iterator(); i.hasNext();) {
Object e = i.next();
sb.append(Strings.getClassName(e.getClass())).
sb.append(ClassUtil.getClassName(e.getClass())).
append(".").append(e);
if (i.hasNext())
sb.append(", ");
@ -135,7 +135,7 @@ public class AnnotationBuilder {
}
protected void toString(StringBuilder sb) {
sb.append("@").append(Strings.getClassName(type));
sb.append("@").append(ClassUtil.getClassName(type));
if (components.size() == 0)
return;
sb.append("(");

View File

@ -72,6 +72,7 @@ import org.apache.openjpa.kernel.QueryLanguages;
import org.apache.openjpa.lib.conf.Configurations;
import org.apache.openjpa.lib.log.Log;
import org.apache.openjpa.lib.meta.SourceTracker;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
import org.apache.openjpa.lib.util.JavaVersions;
import org.apache.openjpa.lib.util.Localizer;
@ -87,7 +88,6 @@ import org.apache.openjpa.meta.SequenceMetaData;
import org.apache.openjpa.meta.ValueMetaData;
import org.apache.openjpa.util.InternalException;
import serp.util.Strings;
//@todo: javadocs
@ -733,7 +733,7 @@ public class AnnotationPersistenceMetaDataSerializer
AnnotationBuilder abEntity = addAnnotation(
getEntityAnnotationType(meta), meta);
if (isMetaDataMode()
&& !meta.getTypeAlias().equals(Strings.getClassName(meta.
&& !meta.getTypeAlias().equals(ClassUtil.getClassName(meta.
getDescribedType())))
abEntity.add("name", meta.getTypeAlias());
@ -1172,8 +1172,7 @@ public class AnnotationPersistenceMetaDataSerializer
* Serialize field mapping content; this will be called before
* {@link #serializeValueMappingContent}. Does nothing by default.
*/
protected void serializeFieldMappingContent(FieldMetaData fmd,
PersistenceStrategy strategy, AnnotationBuilder ab) {
protected void serializeFieldMappingContent(FieldMetaData fmd, PersistenceStrategy strategy, AnnotationBuilder ab) {
}
/**

View File

@ -40,6 +40,7 @@ import org.apache.openjpa.lib.conf.Configurations;
import org.apache.openjpa.lib.log.Log;
import org.apache.openjpa.lib.meta.CFMetaDataSerializer;
import org.apache.openjpa.lib.meta.SourceTracker;
import org.apache.openjpa.lib.util.ClassUtil;
import org.apache.openjpa.lib.util.JavaVersions;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.meta.ClassMetaData;
@ -694,7 +695,7 @@ public class XMLPersistenceMetaDataSerializer
getName()));
if (isMetaDataMode()
&& !meta.getTypeAlias().equals(Strings.getClassName(meta.
&& !meta.getTypeAlias().equals(ClassUtil.getClassName(meta.
getDescribedType())))
addAttribute("name", meta.getTypeAlias());