private void assertTypesAreResolvable() { for ( XProperty xProperty : persistentAttributeMap.values() ) { if ( !xProperty.isTypeResolved() && !discoverTypeWithoutReflection( xProperty ) ) { String msg = "Property " + StringHelper.qualify( xClass.getName(), xProperty.getName() ) + " has an unbound type and no explicit target entity. Resolve this Generic usage issue" + " or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type"; throw new AnnotationException( msg ); } } } //
public void assertTypesAreResolvable(AccessType access) { TreeMap<String, XProperty> xprops; if ( AccessType.PROPERTY.equals( access ) || AccessType.DEFAULT.equals( access ) ) { xprops = propertyAccessMap; } else { xprops = fieldAccessMap; } for ( XProperty property : xprops.values() ) { if ( !property.isTypeResolved() && !discoverTypeWithoutReflection( property ) ) { String msg = "Property " + StringHelper.qualify( xClass.getName(), property.getName() ) + " has an unbound type and no explicit target entity. Resolve this Generic usage issue" + " or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type"; throw new AnnotationException( msg ); } } }
private void assertTypesAreResolvable() { for ( XProperty xProperty : persistentAttributeMap.values() ) { if ( !xProperty.isTypeResolved() && !discoverTypeWithoutReflection( xProperty ) ) { String msg = "Property " + StringHelper.qualify( xClass.getName(), xProperty.getName() ) + " has an unbound type and no explicit target entity. Resolve this Generic usage issue" + " or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type"; throw new AnnotationException( msg ); } } } //
public void test2StepsGenerics() throws Exception { JavaReflectionManager factory = new JavaReflectionManager(); XClass container = factory.toXClass( Container.class ); XProperty contained = container.getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 ); assertTrue( contained.isTypeResolved() ); XProperty generic = contained.getType().getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 ); assertTrue( generic.isTypeResolved() ); }
private void assertTypesAreResolvable(AccessType access) { Map<String, XProperty> xprops; if ( AccessType.PROPERTY.equals( access ) || AccessType.DEFAULT.equals( access ) ) { xprops = propertyAccessMap; } else { xprops = fieldAccessMap; } for ( XProperty property : xprops.values() ) { if ( !property.isTypeResolved() && !discoverTypeWithoutReflection( property ) ) { String msg = "Property " + StringHelper.qualify( xClass.getName(), property.getName() ) + " has an unbound type and no explicit target entity. Resolve this Generic usage issue" + " or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type"; throw new AnnotationException( msg ); } } }
private void assertTypesAreResolvable(AccessType access) { Map<String, XProperty> xprops; if ( AccessType.PROPERTY.equals( access ) || AccessType.DEFAULT.equals( access ) ) { xprops = propertyAccessMap; } else { xprops = fieldAccessMap; } for ( XProperty property : xprops.values() ) { if ( !property.isTypeResolved() && !discoverTypeWithoutReflection( property ) ) { String msg = "Property " + StringHelper.qualify( xClass.getName(), property.getName() ) + " has an unbound type and no explicit target entity. Resolve this Generic usage issue" + " or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type"; throw new AnnotationException( msg ); } } }
public void test2StepsGenericsCollection() throws Exception { JavaReflectionManager factory = new JavaReflectionManager(); XClass container = factory.toXClass( ContainerWithCollection.class ); XProperty collection = container.getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 ); assertTrue( collection.isTypeResolved() ); XClass elementClass = collection.getElementClass(); XProperty generic = elementClass.getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 ); assertTrue( generic.isTypeResolved() ); } }
public void testKnowsWhetherItsTypeIsFullyResolved() { XProperty notFullyResolvedProperty = getPropertyNamed_from( "collectionProperty", dadAsSeenFromItself .getDeclaredProperties( "property" ) ); assertFalse( notFullyResolvedProperty.isTypeResolved() ); XProperty fullyResolvedProperty = getPropertyNamed_from( "collectionProperty", dadAsSeenFromSon .getDeclaredProperties( "property" ) ); assertTrue( fullyResolvedProperty.isTypeResolved() ); }
public void testANN612IssueIsFixed() throws Exception { JavaReflectionManager factory = new JavaReflectionManager(); XClass clazz = factory.toXClass( C.class ); List<XProperty> properties = clazz.getDeclaredProperties( XClass.ACCESS_FIELD ); for( XProperty property : properties ) assertTrue( property.isTypeResolved() ); } }
public void test2StepsGenerics() throws Exception { JavaReflectionManager factory = new JavaReflectionManager(); XClass subclass2 = factory.toXClass( Subclass2.class ); XClass dummySubclass = factory.toXClass( DummySubclass.class ); XClass superclass = subclass2.getSuperclass(); XClass supersuperclass = superclass.getSuperclass(); assertTrue( supersuperclass.getDeclaredProperties( "field" ).get( 1 ).isTypeResolved() ); assertEquals( dummySubclass, supersuperclass.getDeclaredProperties( "field" ).get( 1 ).getType() ); } }