@SuppressWarnings("rawtypes")
	public Object getObjectNeedingRelation(Object domainObject) {
		Object value = null;
		try {
			prepare(domainObject);
			value = this.field.get(domainObject);
			if (value != null && value.getClass().isAnonymousClass())
				value = null; // TODO currently anonymous classes are not mapped
									  // because for reinstantiation we would need dynamic proxies
			if (value != null) {
				if (MappingUtil.isSimpleType(value.getClass())) { // value is of primitive or simple type
					value = null;
				} else {
					Class<?> fieldType = this.field.getType();
					// check for list (collection) or arrays containing primitive or simple types
					Object elem = null;
					boolean testCollOrArray = false;
					if (Collection.class.isAssignableFrom(fieldType)) {
						testCollOrArray = true;
						Collection coll = (Collection) fieldType.cast(value);
						if (coll.size() > 0)
							elem = coll.iterator().next();
					}
					if (fieldType.isArray()) {
						if (fieldType.getComponentType().isPrimitive())
							value = null;
						else {
							testCollOrArray = true;
							Object[] array = (Object[]) fieldType.cast(value);
							if (array.length > 0)
								elem = array[0];
						}
					}
					if (testCollOrArray) {
						if (elem != null) { // first element of collection or array
							Class<?> type = elem.getClass();
							// test the first element,
							// assuming all elements are either complex or simple !!!
							if (MappingUtil.isSimpleType(type)) { // elements are of primitive or simple type
								// to return null
								value = null;
							}
						} else { // empty lists or arrays are mapped to a property
							value = null;
						}
					}
					
					if (Map.class.isAssignableFrom(fieldType)) {
						Map map = (Map)fieldType.cast(value);
						if (map.isEmpty()) // empty maps are mapped to a property
							value = null;
					}
				}
			}
		} catch (Throwable e) {
			throw new RuntimeException(e);
		}
		return value;
	}
@ SuppressWarnings ( "rawtypes" ) public Object getObjectNeedingRelation ( Object domainObject ) { Object value = null ; try { prepare ( domainObject ) ; value = this . field . get ( domainObject ) ; if ( value != null && value . getClass ( ) . isAnonymousClass ( ) ) value = null ; if ( value != null ) { if ( MappingUtil . isSimpleType ( value . getClass ( ) ) ) { value = null ; } else { Class < ? > fieldType = this . field . getType ( ) ; Object elem = null ; boolean testCollOrArray = false ; if ( Collection . class . isAssignableFrom ( fieldType ) ) { testCollOrArray = true ; Collection coll = ( Collection ) fieldType . cast ( value ) ; if ( coll . size ( ) > 0 ) elem = coll . iterator ( ) . next ( ) ; } if ( fieldType . isArray ( ) ) { if ( fieldType . getComponentType ( ) . isPrimitive ( ) ) value = null ; else { testCollOrArray = true ; Object [ ] array = ( Object [ ] ) fieldType . cast ( value ) ; if ( array . length > 0 ) elem = array [ 0 ] ; } } if ( testCollOrArray ) { if ( elem != null ) { Class < ? > type = elem . getClass ( ) ; if ( MappingUtil . isSimpleType ( type ) ) { value = null ; } } else { value = null ; } } if ( Map . class . isAssignableFrom ( fieldType ) ) { Map map = ( Map ) fieldType . cast ( value ) ; if ( map . isEmpty ( ) ) value = null ; } } } } catch ( Throwable e ) { throw new RuntimeException ( e ) ; } return value ; }
@return the value of the field, if this value cannot be mapped to a property,
but must be mapped to a seperate node connected via a relation, else return null.