eu.mihosoft.vmf.vmftext.grammar.impl.ReadOnlyPropertyAnnotationImpl Maven / Gradle / Ivy
The newest version!
package eu.mihosoft.vmf.vmftext.grammar.impl;
// vmf imports
//import eu.mihosoft.vmf.runtime.core.*;
//import eu.mihosoft.vmf.runtime.core.internal.*;
import eu.mihosoft.vcollections.*;
import eu.mihosoft.vmf.vmftext.grammar.*;
import java.beans.PropertyChangeListener;
// property types imports
// interface
/**
* An read-only representation of the model object {@code eu.mihosoft.vmf.vmftext.grammar.PropertyAnnotation}.
*/
@SuppressWarnings("deprecation")
class ReadOnlyPropertyAnnotationImpl implements ReadOnlyPropertyAnnotation, eu.mihosoft.vmf.runtime.core.internal.VObjectInternal, VCloneableInternal {
private final PropertyAnnotation mutableObject;
// Read-only view for collection properties
// - properties with collection type (model & non-model collections)
// - we don't allow/provide setters for collection properties
public ReadOnlyPropertyAnnotationImpl(PropertyAnnotation mutableObject) {
this.mutableObject = mutableObject;
}
@Override
// property type is a model-type
public ReadOnlyProperty getProperty() {
if(this.mutableObject.getProperty()!=null) {
return this.mutableObject.getProperty().asReadOnly();
} else {
return null;
}
}
@Override
public java.lang.String getText() {
return this.mutableObject.getText();
}
// end for each property
@Override
public void addPropertyChangeListener(PropertyChangeListener l) {
((eu.mihosoft.vmf.runtime.core.internal.VObjectInternal)this.mutableObject).addPropertyChangeListener(l);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener l) {
((eu.mihosoft.vmf.runtime.core.internal.VObjectInternal)this.mutableObject).removePropertyChangeListener(l);
}
@Override
public String toString() {
return this.mutableObject.toString();
}
@Override
public boolean equals(Object o) {
return this.mutableObject.equals(o);
}
@Override
public int hashCode() {
return this.mutableObject.hashCode();
}
@Override
public PropertyAnnotation _vmf_getMutableObject() {
return this.mutableObject;
}
@Override
public ReadOnlyPropertyAnnotationImpl asReadOnly() {
return this;
}
// --------------------------------------------------------------------
// --- Cloning
// --------------------------------------------------------------------
@Override
public ReadOnlyPropertyAnnotation clone() {
return this.mutableObject.clone().asReadOnly();
}
@Override
public PropertyAnnotation asModifiable() {
return this.mutableObject.clone();
}
@Override
public PropertyAnnotation _vmf_deepCopy(
java.util.IdentityHashMap