All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nedap.archie.serializer.adl.constraints.CTemporalSerializer Maven / Gradle / Ivy

There is a newer version: 3.12.0
Show newest version
package com.nedap.archie.serializer.adl.constraints;

import com.nedap.archie.aom.primitives.CTemporal;
import com.nedap.archie.serializer.adl.ADLDefinitionSerializer;

/**
 * @author markopi
 */
abstract public class CTemporalSerializer> extends COrderedSerializer {
    public CTemporalSerializer(ADLDefinitionSerializer serializer) {
        super(serializer);
    }

    @Override
    protected void serializeBefore(T cobj) {
        super.serializeBefore(cobj);
        serializePatternedConstraint(cobj);
    }

    private void serializePatternedConstraint(T cobj) {
        if (cobj.getPatternConstraint()!=null) {
            builder.append(cobj.getPatternConstraint());
            if (!cobj.getConstraint().isEmpty()) {
                builder.append("/");
            }
        }
    }

    @Override
    protected boolean shouldIncludeAssumedValue(T cobj) {
        boolean result =  super.shouldIncludeAssumedValue(cobj);
        if (!result) return false;

        return (cobj.getPatternConstraint()!=null ||
                (cobj.getConstraint()!=null && !cobj.getConstraint().isEmpty()));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy