mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
updated version to 1.0.1
This commit is contained in:
parent
765aa591df
commit
2f9e54ed0f
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
<artifactId>querydsl-root</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
|
||||
@ -24,7 +24,8 @@ public class AnimalTest {
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
assertTrue("direct copy of PString field failed", QCat.cat.name == QCat.cat._super.name);
|
||||
assertTrue("direct copy of PString field failed",
|
||||
QAnimalTest_Cat.cat.name == QAnimalTest_Cat.cat._super.name);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -12,43 +12,43 @@ import com.mysema.query.annotations.QueryType;
|
||||
public class BlockingTest extends AbstractTest{
|
||||
|
||||
@QueryEntity
|
||||
public class BlockingTestEntity{
|
||||
public class Entity{
|
||||
|
||||
BlockingTestEntity field1;
|
||||
Entity field1;
|
||||
|
||||
@QueryTransient
|
||||
@QueryType(PropertyType.ENTITY)
|
||||
BlockingTestEntity field2;
|
||||
Entity field2;
|
||||
|
||||
@QueryTransient
|
||||
BlockingTestEntity blockedField;
|
||||
Entity blockedField;
|
||||
}
|
||||
|
||||
@QueryEntity
|
||||
public abstract class BlockingTestEntity2{
|
||||
public abstract class Entity2{
|
||||
|
||||
@QueryTransient
|
||||
@QueryType(PropertyType.ENTITY)
|
||||
public abstract BlockingTestEntity getField2();
|
||||
public abstract Entity getField2();
|
||||
|
||||
@QueryTransient
|
||||
public abstract BlockingTestEntity getBlockedField();
|
||||
public abstract Entity getBlockedField();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
assertTrue(QBlockingTestEntity.blockingTestEntity.field1 != null);
|
||||
assertTrue(QBlockingTestEntity.blockingTestEntity.field2 != null);
|
||||
assertTrue(QBlockingTest_Entity.entity.field1 != null);
|
||||
assertTrue(QBlockingTest_Entity.entity.field2 != null);
|
||||
|
||||
cl = QBlockingTestEntity.class;
|
||||
cl = QBlockingTest_Entity.class;
|
||||
assertMissing("blockedField");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2(){
|
||||
assertTrue(QBlockingTestEntity2.blockingTestEntity2.field2 != null);
|
||||
assertTrue(QBlockingTest_Entity2.entity2.field2 != null);
|
||||
|
||||
cl = QBlockingTestEntity2.class;
|
||||
cl = QBlockingTest_Entity2.class;
|
||||
assertMissing("blockedField");
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import com.mysema.query.types.path.PathMetadata;
|
||||
|
||||
public class EntityTest extends AbstractTest{
|
||||
|
||||
private static final QEntity3 entity3 = QEntity3.entity3;
|
||||
private static final QEntityTest_Entity3 entity3 = QEntityTest_Entity3.entity3;
|
||||
|
||||
@QueryEntity
|
||||
public static class EntityNoReferences {
|
||||
@ -74,26 +74,26 @@ public class EntityTest extends AbstractTest{
|
||||
assertNotNull(entity3._super.superTypeEntityRef.entity2Ref);
|
||||
assertNotNull(entity3._super._super.superTypeEntityRef.entity2Ref);
|
||||
|
||||
assertNotNull(QEntity4.entity4.supertypeField);
|
||||
assertNotNull(QEntityTest_Entity4.entity4.supertypeField);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testConstructors() throws SecurityException, NoSuchMethodException{
|
||||
Class[] types = new Class[]{Class.class, String.class, PathMetadata.class, PathInits.class};
|
||||
QEntity1.class.getConstructor(types);
|
||||
QEntity2.class.getConstructor(types);
|
||||
QEntity3.class.getConstructor(types);
|
||||
QEntity4.class.getConstructor(types);
|
||||
QSupertype.class.getConstructor(types);
|
||||
QSupertype2.class.getConstructor(types);
|
||||
QEntityTest_Entity1.class.getConstructor(types);
|
||||
QEntityTest_Entity2.class.getConstructor(types);
|
||||
QEntityTest_Entity3.class.getConstructor(types);
|
||||
QEntityTest_Entity4.class.getConstructor(types);
|
||||
QEntityTest_Supertype.class.getConstructor(types);
|
||||
QEntityTest_Supertype2.class.getConstructor(types);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test(expected=NoSuchMethodException.class)
|
||||
public void testConstructors2() throws SecurityException, NoSuchMethodException{
|
||||
Class[] types = new Class[]{Class.class, String.class, PathMetadata.class, PathInits.class};
|
||||
QEntityNoReferences.class.getConstructor(types);
|
||||
QEntityTest_EntityNoReferences.class.getConstructor(types);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -23,31 +23,31 @@ public class ExprTest {
|
||||
@Test
|
||||
public void test() throws Throwable {
|
||||
List<Expr<?>> exprs = new ArrayList<Expr<?>>();
|
||||
exprs.add(QAnimal.animal);
|
||||
exprs.add(QCat.cat);
|
||||
exprs.add(QCategory.category);
|
||||
exprs.add(QClassWithConstructor.classWithConstructor);
|
||||
exprs.add(QEntity1.entity1);
|
||||
exprs.add(QEntity2.entity2);
|
||||
exprs.add(QEntity3.entity3);
|
||||
exprs.add(QEntityWithEmbedded.entityWithEmbedded);
|
||||
exprs.add(QGenericType.genericType);
|
||||
exprs.add(QInterfaceType.interfaceType);
|
||||
exprs.add(QInterfaceType2.interfaceType2);
|
||||
exprs.add(QInterfaceType3.interfaceType3);
|
||||
exprs.add(QInterfaceType4.interfaceType4);
|
||||
exprs.add(QInterfaceType5.interfaceType5);
|
||||
exprs.add(QItemType.itemType);
|
||||
exprs.add(QJodaTimeSupport.jodaTimeSupport);
|
||||
exprs.add(QPEntity.pEntity);
|
||||
exprs.add(QPEntity2.pEntity2);
|
||||
exprs.add(QPEntity3.pEntity3);
|
||||
exprs.add(QPEntity4.pEntity4);
|
||||
exprs.add(QQueryTypeEntity.queryTypeEntity);
|
||||
exprs.add(QReference.reference);
|
||||
exprs.add(QRelationType.relationType);
|
||||
exprs.add(QReservedNames.reservedNames);
|
||||
exprs.add(QSimpleTypes.simpleTypes);
|
||||
exprs.add(QAnimalTest_Animal.animal);
|
||||
exprs.add(QAnimalTest_Cat.cat);
|
||||
exprs.add(QConstructorTest_Category.category);
|
||||
exprs.add(QConstructorTest_ClassWithConstructor.classWithConstructor);
|
||||
exprs.add(QEntityTest_Entity1.entity1);
|
||||
exprs.add(QEntityTest_Entity2.entity2);
|
||||
exprs.add(QEntityTest_Entity3.entity3);
|
||||
exprs.add(QEmbeddableTest_EntityWithEmbedded.entityWithEmbedded);
|
||||
exprs.add(QGenericTest_GenericType.genericType);
|
||||
exprs.add(QInterfaceTypeTest_InterfaceType.interfaceType);
|
||||
exprs.add(QInterfaceTypeTest_InterfaceType2.interfaceType2);
|
||||
exprs.add(QInterfaceTypeTest_InterfaceType3.interfaceType3);
|
||||
exprs.add(QInterfaceTypeTest_InterfaceType4.interfaceType4);
|
||||
exprs.add(QInterfaceTypeTest_InterfaceType5.interfaceType5);
|
||||
exprs.add(QGenericTest_ItemType.itemType);
|
||||
exprs.add(QJodaTimeSupportTest_JodaTimeSupport.jodaTimeSupport);
|
||||
exprs.add(QQueryInitTest_PEntity.pEntity);
|
||||
exprs.add(QQueryInitTest_PEntity2.pEntity2);
|
||||
exprs.add(QQueryInitTest_PEntity3.pEntity3);
|
||||
exprs.add(QQueryInitTest_PEntity4.pEntity4);
|
||||
exprs.add(QQueryTypeTest_QueryTypeEntity.queryTypeEntity);
|
||||
exprs.add(QRelationTest_Reference.reference);
|
||||
exprs.add(QRelationTest_RelationType.relationType);
|
||||
exprs.add(QReservedNamesTest_ReservedNames.reservedNames);
|
||||
exprs.add(QSimpleTypesTest_SimpleTypes.simpleTypes);
|
||||
|
||||
exprs.add(EStringConst.create("Hello World!"));
|
||||
exprs.add(ENumberConst.create(1000));
|
||||
|
||||
@ -42,7 +42,7 @@ public class ExtendsAndSuperTest {
|
||||
|
||||
@Test
|
||||
public void validate(){
|
||||
QExtendsAndSuper var = QExtendsAndSuper.extendsAndSuper;
|
||||
QExtendsAndSuperTest_ExtendsAndSuper var = QExtendsAndSuperTest_ExtendsAndSuper.extendsAndSuper;
|
||||
assertEquals(Object.class, var.extendsCol.getElementType());
|
||||
assertEquals(CharSequence.class, var.extendsCol2.getElementType());
|
||||
|
||||
@ -52,7 +52,7 @@ public class ExtendsAndSuperTest {
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
QExtendsAndSuper var = QExtendsAndSuper.extendsAndSuper;
|
||||
QExtendsAndSuperTest_ExtendsAndSuper var = QExtendsAndSuperTest_ExtendsAndSuper.extendsAndSuper;
|
||||
ExtendsAndSuper<Object> entity = new ExtendsAndSuper<Object>();
|
||||
var.eq(entity);
|
||||
|
||||
|
||||
@ -45,13 +45,13 @@ public class Inheritance3Test extends AbstractTest{
|
||||
@Ignore
|
||||
public void test() throws SecurityException, NoSuchFieldException{
|
||||
// FIXME
|
||||
cl = QGenericSupertype.class;
|
||||
cl = QInheritance3Test_GenericSupertype.class;
|
||||
match(PSimple.class, "field");
|
||||
|
||||
cl = QGenericSupertypeC.class;
|
||||
cl = QInheritance3Test_GenericSupertypeC.class;
|
||||
match(PComparable.class, "field");
|
||||
|
||||
cl = QGenericSupertypeS.class;
|
||||
cl = QInheritance3Test_GenericSupertypeS.class;
|
||||
match(PString.class, "field");
|
||||
}
|
||||
|
||||
|
||||
@ -41,13 +41,13 @@ public class Inheritance4Test extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void test() throws SecurityException, NoSuchFieldException{
|
||||
cl = QEntityWithComparable.class;
|
||||
cl = QInheritance4Test_EntityWithComparable.class;
|
||||
match(PSimple.class, "field");
|
||||
|
||||
cl = QEntityWithNumber.class;
|
||||
cl = QInheritance4Test_EntityWithNumber.class;
|
||||
match(PNumber.class, "field");
|
||||
|
||||
cl = QEntityWithString.class;
|
||||
cl = QInheritance4Test_EntityWithString.class;
|
||||
match(PString.class, "field");
|
||||
|
||||
}
|
||||
|
||||
@ -54,31 +54,31 @@ public class InterfaceTypeTest extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void QInterfaceType_reation() throws SecurityException, NoSuchFieldException{
|
||||
cl = QInterfaceType.class;
|
||||
match(QInterfaceType.class, "relation");
|
||||
cl = QInterfaceTypeTest_InterfaceType.class;
|
||||
match(QInterfaceTypeTest_InterfaceType.class, "relation");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void QInterfaceType_reation2() throws SecurityException, NoSuchFieldException{
|
||||
cl = QInterfaceType.class;
|
||||
cl = QInterfaceTypeTest_InterfaceType.class;
|
||||
match(PList.class, "relation2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void QInterfaceType_reation3() throws SecurityException, NoSuchFieldException{
|
||||
cl = QInterfaceType.class;
|
||||
cl = QInterfaceTypeTest_InterfaceType.class;
|
||||
match(PList.class, "relation3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void QInterfaceType_reation4() throws SecurityException, NoSuchFieldException{
|
||||
cl = QInterfaceType.class;
|
||||
cl = QInterfaceTypeTest_InterfaceType.class;
|
||||
match(PNumber.class, "relation4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQInterfaceType3() throws SecurityException, NoSuchFieldException{
|
||||
Class<?> cl = QInterfaceType3.class;
|
||||
Class<?> cl = QInterfaceTypeTest_InterfaceType3.class;
|
||||
cl.getField("prop");
|
||||
cl.getField("prop2");
|
||||
cl.getField("prop3");
|
||||
@ -86,7 +86,7 @@ public class InterfaceTypeTest extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void testQInterfaceType5() throws SecurityException, NoSuchFieldException{
|
||||
Class<?> cl = QInterfaceType5.class;
|
||||
Class<?> cl = QInterfaceTypeTest_InterfaceType5.class;
|
||||
cl.getField("prop");
|
||||
cl.getField("prop2");
|
||||
cl.getField("prop3");
|
||||
|
||||
@ -36,12 +36,12 @@ public class JDOTest extends AbstractTest {
|
||||
|
||||
@Test
|
||||
public void test() throws SecurityException, NoSuchFieldException {
|
||||
cl = QJDOEntity.class;
|
||||
cl = QJDOTest_JDOEntity.class;
|
||||
match(PString.class, "prop");
|
||||
assertMissing("skipped");
|
||||
assertMissing("skippedEntity");
|
||||
|
||||
cl = QJDOEntity2.class;
|
||||
cl = QJDOTest_JDOEntity2.class;
|
||||
match(PString.class, "stringField1");
|
||||
match(PString.class, "stringField2");
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class JPATest extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void test() throws SecurityException, NoSuchFieldException{
|
||||
cl = QJPAEntity.class;
|
||||
cl = QJPATest_JPAEntity.class;
|
||||
match(PString.class, "prop");
|
||||
assertMissing("skipped");
|
||||
assertMissing("skippedEntity");
|
||||
|
||||
@ -38,7 +38,7 @@ public class JodaTimeSupportTest extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void test() throws SecurityException, NoSuchFieldException {
|
||||
cl = QJodaTimeSupport.class;
|
||||
cl = QJodaTimeSupportTest_JodaTimeSupport.class;
|
||||
match(PDateTime.class, "dateMidnight");
|
||||
match(PDateTime.class, "dateTime");
|
||||
match(PDateTime.class, "instant");
|
||||
|
||||
@ -16,10 +16,10 @@ public class PathMetadataTest {
|
||||
|
||||
@Before
|
||||
public void setUp(){
|
||||
assertNotNull(QAnimal.animal);
|
||||
assertNotNull(QCat.cat);
|
||||
assertNotNull(QCategory.category);
|
||||
assertNotNull(QSimpleTypes.simpleTypes);
|
||||
assertNotNull(QAnimalTest_Animal.animal);
|
||||
assertNotNull(QAnimalTest_Cat.cat);
|
||||
assertNotNull(QConstructorTest_Category.category);
|
||||
assertNotNull(QSimpleTypesTest_SimpleTypes.simpleTypes);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@ -40,8 +40,8 @@ public class QueryInit2Test {
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
assertNotNull(QCategorization.categorization.event.account.owner);
|
||||
assertNotNull(QCategorization.categorization.event.as(QActivation.class).account.owner);
|
||||
assertNotNull(QQueryInit2Test_Categorization.categorization.event.account.owner);
|
||||
assertNotNull(QQueryInit2Test_Categorization.categorization.event.as(QQueryInit2Test_Activation.class).account.owner);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,9 +9,9 @@ import com.mysema.query.annotations.QueryInit;
|
||||
|
||||
public class QueryInitTest {
|
||||
|
||||
private static final QPEntity e1 = QPEntity.pEntity;
|
||||
private static final QQueryInitTest_PEntity e1 = QQueryInitTest_PEntity.pEntity;
|
||||
|
||||
private static final QPEntity2 e2 = QPEntity2.pEntity2;
|
||||
private static final QQueryInitTest_PEntity2 e2 = QQueryInitTest_PEntity2.pEntity2;
|
||||
|
||||
@QueryEntity
|
||||
public static class PEntity{
|
||||
|
||||
@ -51,10 +51,10 @@ public class QueryProjectionTest {
|
||||
|
||||
@Test
|
||||
public void entityCase(){
|
||||
QEntityWithProjection.create(ExprConst.create(0l)).getJavaConstructor();
|
||||
QEntityWithProjection.create(EStringConst.create("")).getJavaConstructor();
|
||||
QEntityWithProjection.create(ENumberConst.create(0l), EStringConst.create("")).getJavaConstructor();
|
||||
QEntityWithProjection.create(EStringConst.create(""), EStringConst.create("")).getJavaConstructor();
|
||||
QQueryProjectionTest_EntityWithProjection.create(ExprConst.create(0l)).getJavaConstructor();
|
||||
QQueryProjectionTest_EntityWithProjection.create(EStringConst.create("")).getJavaConstructor();
|
||||
QQueryProjectionTest_EntityWithProjection.create(ENumberConst.create(0l), EStringConst.create("")).getJavaConstructor();
|
||||
QQueryProjectionTest_EntityWithProjection.create(EStringConst.create(""), EStringConst.create("")).getJavaConstructor();
|
||||
}
|
||||
|
||||
public static class DTOWithProjection {
|
||||
@ -101,10 +101,10 @@ public class QueryProjectionTest {
|
||||
|
||||
@Test
|
||||
public void dtoCase() throws SecurityException, NoSuchMethodException{
|
||||
new QDTOWithProjection(ExprConst.create(0l)).getJavaConstructor();
|
||||
new QDTOWithProjection(EStringConst.create("")).getJavaConstructor();
|
||||
new QDTOWithProjection(ENumberConst.create(0l), EStringConst.create("")).getJavaConstructor();
|
||||
new QDTOWithProjection(EStringConst.create(""), EStringConst.create("")).getJavaConstructor();
|
||||
new QQueryProjectionTest_DTOWithProjection(ExprConst.create(0l)).getJavaConstructor();
|
||||
new QQueryProjectionTest_DTOWithProjection(EStringConst.create("")).getJavaConstructor();
|
||||
new QQueryProjectionTest_DTOWithProjection(ENumberConst.create(0l), EStringConst.create("")).getJavaConstructor();
|
||||
new QQueryProjectionTest_DTOWithProjection(EStringConst.create(""), EStringConst.create("")).getJavaConstructor();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ public class QueryTypeTest extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void test() throws SecurityException, NoSuchFieldException{
|
||||
cl = QQueryTypeEntity.class;
|
||||
cl = QQueryTypeTest_QueryTypeEntity.class;
|
||||
match(PSimple.class, "stringAsSimple");
|
||||
match(PComparable.class, "stringAsComparable");
|
||||
match(PDate.class, "stringAsDate");
|
||||
|
||||
@ -100,7 +100,7 @@ public class RelationTest extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void test() throws SecurityException, NoSuchFieldException{
|
||||
cl = QRelationType.class;
|
||||
cl = QRelationTest_RelationType.class;
|
||||
match(PSimple.class, "enumProperty");
|
||||
match(PList.class, "enumList");
|
||||
match(PMap.class, "enumMap1");
|
||||
@ -141,11 +141,11 @@ public class RelationTest extends AbstractTest{
|
||||
@Test
|
||||
public void listUsage(){
|
||||
String expected = "relationType.list.get(0).set";
|
||||
assertEquals(expected, QRelationType.relationType.list.get(0).set.toString());
|
||||
assertEquals(expected, QRelationType.relationType.list(0).set.toString());
|
||||
assertEquals(expected, QRelationTest_RelationType.relationType.list.get(0).set.toString());
|
||||
assertEquals(expected, QRelationTest_RelationType.relationType.list(0).set.toString());
|
||||
|
||||
assertEquals(List.class, QRelationType.relationType.list.getType());
|
||||
assertEquals(Set.class, QRelationType.relationType.set.getType());
|
||||
assertEquals(List.class, QRelationTest_RelationType.relationType.list.getType());
|
||||
assertEquals(Set.class, QRelationTest_RelationType.relationType.set.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public class ReservedNamesTest {
|
||||
|
||||
@Test
|
||||
public void test() throws SecurityException, NoSuchFieldException{
|
||||
Class<?> cl = QReservedNames.class;
|
||||
Class<?> cl = QReservedNamesTest_ReservedNames.class;
|
||||
cl.getField("new_");
|
||||
cl.getField("package_");
|
||||
cl.getField("protected_");
|
||||
|
||||
@ -183,15 +183,15 @@ public class SimpleTypesTest extends AbstractTest{
|
||||
@Test
|
||||
public void listAccess(){
|
||||
// date / time
|
||||
QSimpleTypes.simpleTypes.dateList.get(0).after(new Date());
|
||||
QSimpleTypes.simpleTypes.timeList.get(0).after(new Time(0l));
|
||||
QSimpleTypes.simpleTypes.calendarList.get(0).before(Calendar.getInstance());
|
||||
QSimpleTypesTest_SimpleTypes.simpleTypes.dateList.get(0).after(new Date());
|
||||
QSimpleTypesTest_SimpleTypes.simpleTypes.timeList.get(0).after(new Time(0l));
|
||||
QSimpleTypesTest_SimpleTypes.simpleTypes.calendarList.get(0).before(Calendar.getInstance());
|
||||
|
||||
// numeric
|
||||
QSimpleTypes.simpleTypes.bbyteList.get(0).abs();
|
||||
QSimpleTypesTest_SimpleTypes.simpleTypes.bbyteList.get(0).abs();
|
||||
|
||||
// string
|
||||
QSimpleTypes.simpleTypes.sstringList.get(0).toLowerCase();
|
||||
QSimpleTypesTest_SimpleTypes.simpleTypes.sstringList.get(0).toLowerCase();
|
||||
|
||||
// boolean
|
||||
// QSimpleTypes.simpleTypes.b
|
||||
@ -200,7 +200,7 @@ public class SimpleTypesTest extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void testSimpleTypes() throws SecurityException, NoSuchFieldException{
|
||||
cl = QSimpleTypes.class;
|
||||
cl = QSimpleTypesTest_SimpleTypes.class;
|
||||
match(PNumber.class, "id");
|
||||
match(PNumber.class, "bigDecimal");
|
||||
match(PNumber.class, "bbyte");
|
||||
@ -242,36 +242,36 @@ public class SimpleTypesTest extends AbstractTest{
|
||||
|
||||
@Test
|
||||
public void customLiteral() throws SecurityException, NoSuchFieldException{
|
||||
cl = QSimpleTypes.class;
|
||||
cl = QSimpleTypesTest_SimpleTypes.class;
|
||||
match(PSimple.class, "customLiteral");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customComparableLiteral() throws SecurityException, NoSuchFieldException{
|
||||
cl = QSimpleTypes.class;
|
||||
cl = QSimpleTypesTest_SimpleTypes.class;
|
||||
match(PComparable.class, "customComparableLiteral");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customNumber() throws SecurityException, NoSuchFieldException{
|
||||
cl = QSimpleTypes.class;
|
||||
cl = QSimpleTypesTest_SimpleTypes.class;
|
||||
match(PSimple.class, "customNumber");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customComparableNumber() throws SecurityException, NoSuchFieldException{
|
||||
cl = QSimpleTypes.class;
|
||||
cl = QSimpleTypesTest_SimpleTypes.class;
|
||||
match(PNumber.class, "customComparableNumber");
|
||||
}
|
||||
|
||||
@Test(expected=NoSuchFieldException.class)
|
||||
public void skippedField1() throws SecurityException, NoSuchFieldException {
|
||||
QSimpleTypes.class.getField("skipMe");
|
||||
QSimpleTypesTest_SimpleTypes.class.getField("skipMe");
|
||||
}
|
||||
|
||||
@Test(expected=NoSuchFieldException.class)
|
||||
public void skippedField2() throws SecurityException, NoSuchFieldException {
|
||||
QSimpleTypes.class.getField("test");
|
||||
QSimpleTypesTest_SimpleTypes.class.getField("test");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
<artifactId>querydsl-root</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
<artifactId>querydsl-root</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
|
||||
@ -117,8 +117,9 @@ public abstract class AbstractSerializer implements Serializer{
|
||||
case MAP:
|
||||
case SIMPLE:
|
||||
return typeName + "<" + localGenericName + ">";
|
||||
case ENTITY:
|
||||
String suffix = type.getSimpleName();
|
||||
case ENTITY:
|
||||
// String suffix = type.getSimpleName();
|
||||
String suffix = type.getFullName().substring(type.getPackageName().length()+1).replace('.', '_');
|
||||
if (type.getPackageName().equals(model.getPackageName())){
|
||||
return model.getPrefix() + suffix;
|
||||
}else{
|
||||
|
||||
@ -24,8 +24,7 @@ public class DTOSerializer extends AbstractSerializer{
|
||||
// intro
|
||||
intro(model, writer);
|
||||
|
||||
final String simpleName = model.getSimpleName();
|
||||
final String queryType = model.getPrefix() + simpleName;
|
||||
final String queryType = getPathType(model, model, false);
|
||||
final String localName = model.getLocalRawName();
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
@ -74,7 +73,7 @@ public class DTOSerializer extends AbstractSerializer{
|
||||
|
||||
protected void intro(EntityModel model, Writer writer) throws IOException {
|
||||
final String simpleName = model.getSimpleName();
|
||||
final String queryType = model.getPrefix() + simpleName;
|
||||
final String queryType = getPathType(model, model, false);
|
||||
final String localName = model.getLocalRawName();
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@ -141,10 +141,7 @@ public class EntitySerializer extends AbstractSerializer{
|
||||
protected void initEntityFields(StringBuilder builder, EntityModel model) {
|
||||
EntityModel superModel = model.getSuperModel();
|
||||
if (superModel != null && superModel.hasEntityFields()){
|
||||
String superQueryType = superModel.getPrefix() + superModel.getSimpleName();
|
||||
if (!superModel.getPackageName().equals(model.getPackageName())){
|
||||
superQueryType = superModel.getPackageName() + "." + superQueryType;
|
||||
}
|
||||
String superQueryType = getPathType(superModel, model, false);
|
||||
builder.append(" this._super = new " + superQueryType + "(type, entityName, metadata, inits);\n");
|
||||
}
|
||||
|
||||
@ -297,10 +294,8 @@ public class EntitySerializer extends AbstractSerializer{
|
||||
|
||||
protected void introSuper(StringBuilder builder, EntityModel model) {
|
||||
EntityModel superModel = model.getSuperModel();
|
||||
String superQueryType = superModel.getPrefix() + superModel.getSimpleName();
|
||||
if (!model.getPackageName().equals(superModel.getPackageName())){
|
||||
superQueryType = superModel.getPackageName() + "." + superQueryType;
|
||||
}
|
||||
String superQueryType = getPathType(superModel, model, false);
|
||||
|
||||
if (!superModel.hasEntityFields()){
|
||||
builder.append(" public final "+superQueryType+" _super = new " + superQueryType + "(this);\n\n");
|
||||
}else{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
<artifactId>querydsl-root</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
<artifactId>querydsl-root</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
<artifactId>querydsl-root</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.1</version>
|
||||
<name>Querydsl</name>
|
||||
<description>parent project for querydsl modules</description>
|
||||
<url>http://source.mysema.com/display/querydsl</url>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
<artifactId>querydsl-root</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.mysema.querydsl</groupId>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user