package au.gov.ga.geodesy.support.mapper.orika.geodesyml;

import au.gov.ga.geodesy.exception.GeodesyRuntimeException;
import au.gov.ga.geodesy.support.gml.GMLPropertyType;
import au.gov.ga.geodesy.support.java.util.Iso;

import net.opengis.gml.v_3_2_1.AbstractGMLType;

/**
 * Reversible mapping between a GML property type and its target element.
 */
public class GMLPropertyTypeMapper<P extends GMLPropertyType, T extends AbstractGMLType> implements Iso<P, T> {

    public T to(P p) {
        return p.getTargetElement();
    }

    public P from(T t) {
        throw new GeodesyRuntimeException("TODO");
    }
}


@@ -564,49 +564,588 @@
    t
-hrow new GeodesyRuntimeException(%22TODO%22);
+ry %7B%0A            String elementTypeName = t.getClass().getName();%0A            String propertyTypeName = elementTypeName.substring(0, elementTypeName.length() - 4) + %22PropertyType%22;%0A            @SuppressWarnings(%22unchecked%22)%0A            P p = (P) Class.forName(propertyTypeName).newInstance();%0A            p.setTargetElement(t);%0A            return p;%0A        %7D catch (InstantiationException %7C IllegalAccessException %7C ClassNotFoundException e) %7B%0A            throw new GeodesyRuntimeException(%22Failed to wrap %22 + t.getClass().getSimpleName() + %22 in GML property type%22, e);%0A        %7D
 %0A   

Complete GMLPropertyType mapper