org.nakedobjects.applib.adapters.AbstractValueSemanticsProvider Maven / Gradle / Ivy
The newest version!
package org.nakedobjects.applib.adapters;
public abstract class AbstractValueSemanticsProvider implements ValueSemanticsProvider {
private boolean immutable;
private boolean equalByContent;
/**
* Defaults {@link #isImmutable()} to true and {@link #isEqualByContent()} to true
* also.
*/
public AbstractValueSemanticsProvider() {
this(true, true);
}
public AbstractValueSemanticsProvider(final boolean immutable, final boolean equalByContent) {
this.immutable = immutable;
this.equalByContent = equalByContent;
}
public EncoderDecoder getEncoderDecoder() {
return (EncoderDecoder) (this instanceof EncoderDecoder ? this : null);
}
public Parser getParser() {
return (Parser) (this instanceof Parser ? this : null);
}
public DefaultsProvider getDefaultsProvider() {
return (DefaultsProvider) (this instanceof DefaultsProvider ? this : null);
}
/**
* Defaults to true if no-arg constructor is used.
*/
public boolean isEqualByContent() {
return equalByContent;
}
/**
* Defaults to true if no-arg constructor is used.
*/
public boolean isImmutable() {
return immutable;
}
}
// Copyright (c) Naked Objects Group Ltd.