Search in sources :

Example 1 with PdxFieldDoesNotExistException

use of org.apache.geode.pdx.PdxFieldDoesNotExistException in project geode by apache.

the class PdxWriterImpl method markIdentityField.

public PdxWriter markIdentityField(String fieldName) {
    if (definingNewPdxType()) {
        PdxField ft = this.newType.getPdxField(fieldName);
        if (ft == null) {
            throw new PdxFieldDoesNotExistException("Field " + fieldName + " must be written before calling markIdentityField");
        }
        ft.setIdentityField(true);
    } else if (doExtraValidation()) {
        PdxField ft = this.existingType.getPdxField(fieldName);
        if (ft == null) {
            throw new PdxFieldDoesNotExistException("Field " + fieldName + " must be written before calling markIdentityField");
        } else if (!ft.isIdentityField()) {
            throw new PdxSerializationException("Expected field " + fieldName + " to not be marked as an identity field since it was not for the first serialization");
        }
    }
    return this;
}
Also used : PdxSerializationException(org.apache.geode.pdx.PdxSerializationException) PdxFieldDoesNotExistException(org.apache.geode.pdx.PdxFieldDoesNotExistException)

Aggregations

PdxFieldDoesNotExistException (org.apache.geode.pdx.PdxFieldDoesNotExistException)1 PdxSerializationException (org.apache.geode.pdx.PdxSerializationException)1