Class AbstractReference<TARGET extends IPropCnr>
- All Implemented Interfaces:
- EventListener,- IGProp<ReferenceString>,- IPropReference,- IReferencingGProp,- Cloneable
- Direct Known Subclasses:
- AbstractBaseRelativeReference,- FixedVirtualizedAbstractReference,- ServerConfigEnvReference,- VSReference
- Author:
- Christopher Mindus
- Nested Class Summary- Nested classes/interfaces inherited from interface com.iizix.prop.IPropReference- IPropReference.IRefType, IPropReference.ReferenceChangeEvent, IPropReference.RefType
- Field SummaryFieldsModifier and TypeFieldDescription- static final StringThe ID of the property error.- protected booleanValidation completed flag.- static final StringQuick-fix ID for delete property, defined in "com.iizigo.quickfix.fixer.DeleteProperty".- protected PropReferenceThe instance of the property reference.- Fields inherited from class com.iizix.prop.GProp- GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2- Fields inherited from interface com.iizix.prop.IGProp- EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
- Constructor SummaryConstructorsModifierConstructorDescription- protectedCreates a Abstract Reference property with no name and with a null value.- protected- AbstractReference- (Atom propertyAtom) Creates a Abstract Reference property with the specified name with a- nullvalue.- protected- AbstractReference- (Atom propertyAtom, String newValue) Creates a Abstract Reference property with the specified name and value.
- Method SummaryModifier and TypeMethodDescription- protected void- appendPropValue- (PropMgr propertyManager, SendTransaction trans, Object value) Appends the string property value.- protected void- assignError- (String err) Assigns a property error message of ERROR severity with DeleteProperty quick-fix.- protected voidAssigns not found error.- protected void- changeReference- (String oldName, String newName, PropReference ref) Called to update a reference from an old name to a new name.- protected void- checkCreateReference- (GEvent event) Checks for tree to be valid in order to create the reference.- protected voidClears the property error.- protected voidCalled to clear the fixed reference in case the reference is changed.- clone()Cloning must duplicate reference into new tree.- protected final void- createUpdateReference- (PropReference ref, boolean doReCheck, ResolveReferencesEvent event) Resolves or creates the reference.- protected final voidDisposes of the reference and possible cached target.- protected booleanReturns if resolving of this reference should be done in post- (true) or pre-stage (false).- protected final boolean- equalsErrors- (PropError pe1, PropError pe2, int how) Processes error property verification.- protected final Object- equalValues- (GProp<?> compareTo, ReferenceString thisValue, ReferenceString compareValue, int how) Checks for property value equality.- final StringGets the absolute reference as a String.- final IGProp- <?> Gets the single-referenced target.Gets the set of properties that this referencing property directly references.- protected TARGETSupport for a fixed reference.- protected StringCreates the reference string to look-up from the ReferenceString.- abstract Class- <?> Gets the class wanted.- protected final Object- getPropValue0- (Object value, int index) Gets the property value in another class form than the "native" one.- final StringGets the reference string.- protected ReferenceStringGets the current reference string.- abstract IPropReference.IRefTypeGets the reference Type.Gets the target reference also trying to resolve the reference, i.e.- getTargetReference- (GProp<?> anyPropertyInTree) Gets the target reference also trying to resolve the reference, i.e.- final Class<?>[]Gets the list of possible native Java classes that can be used to set a value using- setPropertyValue, in order of importance.- protected voidCalled when the property has been cleared from error.- protected voidCalled when the property has an error.- protected voidCalled when the property has been resolved.- boolean- initializeValue- (PropMgr propertyManager, ReadTransaction trans) Initializes the property value from a transaction.- abstract boolean- isReferenceValid- (GProp<?> property) Validates the property reference that has been looked up.- final booleanGets if this referencing property is of single-reference type or that can have between zero and many references.- boolean- isValid()Checks if the resolving of the reference is valid with the automatic resolving mechanism.- protected final int- modifyPropValue- (Object oldValue, Object newValue, PropMgr propMgr) Called when setting a new value for this property.- void- onEventSelf- (GEvent event) Called when a property event is send to this property.- protected final voidCalled when a project name has been changed.- protected final voidProperty disposed of: dispose of reference.- protected void- onPropParentChanged- (PropCnr oldParent, PropCnr newParent) Called when parent changed.- protected void- onRefactored- (String oldName, String newName) Called when the property is refactored.- protected voidCalled when the reference is disposed of.- protected voidCalled to perform reference resolving.- void- onReferenceEvent- (PropReference ref, IPropReference.ReferenceChangeEvent event, GEvent triggerEvent) Called when a property reference event occurs.- protected StringReturns the parameter string representing the state of this event.- protected String- setLookedUpReference- (String name) Sets the reference found that also has been validated.- final boolean- setPropValue- (String newValue) Sets a new value for this property.- protected final Object- toNativeValue0- (Object value, int index) Tries conversion of possibly accepted properties values using the- setPropertyValuemethod into the most preferred property value type.- protected final void- updateReference- (GEvent event) Called to establish a new reference after name change or parent-hood.- final void- validatePropType- (Object newValue) Validates that the value to set is of ReferenceString instance.- final void- validatePropValue- (Object newValue) Validates the value to set.- protected String- validateReferenceScope- (TARGET target) Called when the a property container has been renamed or moved in order to perform validation of the reference, e.g.- wouldValidate- (GProp<?> anyPropertyInTree) Checks if the reference would be valid if this property is attached to a root property.- Methods inherited from class com.iizix.prop.GProp- addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsObj, equalsPropValue, equalsTree, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropBaseReference, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, getVSReference, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeElement, initializeGElement, initializeGProp, initializeProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCommunicating, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onPrepare, onPropInvalidateCache, onPropTreeInitialized, onPropValueSet, onRemoteEvent, onVirtualizationCompleted, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, resolveRuntimeReferences, setChanged, setConstraints, setConstraints, setCreateRequiredProp, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toElementString, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, verify, virtualize, warning, warning, warning- Methods inherited from class java.lang.Object- getClass, hashCode, notify, notifyAll, wait, wait, wait- Methods inherited from interface com.iizix.prop.IReferencingGProp- getParent, getReferencingOwner
- Field Details- ERROR_IDThe ID of the property error.- See Also:
 
- QUICK_FIX_DELETE_PROPQuick-fix ID for delete property, defined in "com.iizigo.quickfix.fixer.DeleteProperty".- See Also:
 
- referenceThe instance of the property reference.
- hasBeenValidatedprotected boolean hasBeenValidatedValidation completed flag.
 
- Constructor Details- AbstractReferenceprotected AbstractReference()Creates a Abstract Reference property with no name and with a null value.
- AbstractReferenceCreates a Abstract Reference property with the specified name with a- nullvalue.- Parameters:
- propertyAtom- the property atom.
 
- AbstractReferenceCreates a Abstract Reference property with the specified name and value.- Parameters:
- propertyAtom- the property atom.
- newValue- the new string value for the property.
 
 
- Method Details- doPostResolveprotected boolean doPostResolve()Returns if resolving of this reference should be done in post- (true) or pre-stage (false).- Returns:
- false by default, i.e. always in first pre-stage.
 
- getFixedTargetSupport for a fixed reference.- Override to provide the support. - Returns:
- The fixed reference to return in cases the target reference is needed, and also serves as a verification if a new reference should be created or not. Returning nullcauses normal behavior (default).
 
- clearFixedTargetprotected void clearFixedTarget()Called to clear the fixed reference in case the reference is changed. This will revert back to normal processing.- The "clone" method does not change to be overridden to clear the fixed target as this method is called during cloning. - Override to provide the support. It is important to also implement this method along with "getFixedTarget". 
- getAbsoluteReferenceGets the absolute reference as a String.- Returns:
- A non-relative absolute reference string, empty string if reference property is disposed of, or nullif none exists.
 
- setPropValueSets a new value for this property. If any listener is present and the value has changed compare to the last value, the listener is informed.- Parameters:
- newValue- the new value.
- Returns:
- boolean true for value has changed, false for same value as current value.
- Throws:
- PropTypeException- If the property is read-only.
- PropValidateException- When the constraints are not met.
 
- validatePropTypeValidates that the value to set is of ReferenceString instance.- Note: When this method is called, synchronization is done at the property itself, so no synchronization on the tree should be done. - Specified by:
- validatePropTypein interface- IGProp<TARGET extends IPropCnr>
- Specified by:
- validatePropTypein class- GProp<ReferenceString>
- Parameters:
- newValue- The new value to set.
- Throws:
- PropTypeException- when the new value isn't of the correct class.
 
- validatePropValueValidates the value to set. Subclasses can override this method to perform optional value validation. No validation is performed in this method.- Note: When this method is called, synchronization is done at the property itself, so no synchronization on the tree should be done. - Specified by:
- validatePropValuein interface- IGProp<TARGET extends IPropCnr>
- Overrides:
- validatePropValuein class- GProp<ReferenceString>
- Parameters:
- newValue- The new value to set.
- Throws:
- PropException- when the new value doesn't validate correctly.
 
- modifyPropValueCalled when setting a new value for this property.- Overrides:
- modifyPropValuein class- GProp<ReferenceString>
- Parameters:
- oldValue- The old value.
- newValue- The new value.
- propMgr- The property manager for remote change, null for local.
- Returns:
- -1 for not processed.
 
- getValueClassesGets the list of possible native Java classes that can be used to set a value using- setPropertyValue, in order of importance. Note that loss of precision in data if e.g. an Float property accepts a Double. However, the- setPropertyValuethrows- IllegalArgumentExceptionif the range in invalid, e.g. conversion of a Integer to a Byte, and the value is not -127 to 128.- Specified by:
- getValueClassesin interface- IGProp<TARGET extends IPropCnr>
- Specified by:
- getValueClassesin class- GProp<ReferenceString>
- Returns:
- The array of Java classes that can be accepted in the setPropertyValuemethod. The first type is the "native" or most preferred type. The array is at least one item in length and never null.
 
- appendPropValueAppends the string property value. If uninitialized, an empty string is appended.- Specified by:
- appendPropValuein class- GProp<ReferenceString>
- Parameters:
- propertyManager- the property manager instance.
- trans- transaction to append the properties to.
- value- the value to append to the transaction, a reference to the current property value.
 
- initializeValueInitializes the property value from a transaction.- Specified by:
- initializeValuein class- GProp<ReferenceString>
- Parameters:
- propertyManager- the property manager.
- trans- the transaction to initialize the property with.
- Returns:
- true if the value has changed, false otherwise.
- Throws:
- PropException
 
- getReferenceGets the reference string.- Returns:
- The reference string or nullif not set.
 
- getPropValue0Gets the property value in another class form than the "native" one. This method tries conversion of a "native" property value into another class type. This method is used when filling in a POJO variable (Plain Old Java Object Field) from a "native" property value.- Specified by:
- getPropValue0in class- GProp<ReferenceString>
- Parameters:
- value- The property value.
- index- The index in the Class array returned by- getValueClasses().
- Returns:
- The property value in the requested class, after conversion.
- Throws:
- Exception- Other exceptions that could occur.
 
- toNativeValue0Tries conversion of possibly accepted properties values using the- setPropertyValuemethod into the most preferred property value type. If the input value already is of the preferred type, the same object is returned.- Specified by:
- toNativeValue0in class- GProp<ReferenceString>
- Parameters:
- value- The input value to convert to native value.
- index- The index in the array returned by- getValueClasses(), or -1 if not found.
- Returns:
- The converted input value in the preferred property value object type.
- Throws:
- Exception- For conversion exceptions.
 
- disposeReferenceprotected final void disposeReference()Disposes of the reference and possible cached target.
- onReferenceDisposedprotected void onReferenceDisposed()Called when the reference is disposed of.
- onPropDisposeprotected final void onPropDispose()Property disposed of: dispose of reference.- Overrides:
- onPropDisposein class- GProp<ReferenceString>
 
- cloneCloning must duplicate reference into new tree.- Overrides:
- clonein class- GProp<ReferenceString>
 
- equalValuesprotected final Object equalValues- (GProp<?> compareTo, ReferenceString thisValue, ReferenceString compareValue, int how) Checks for property value equality. The object is of the correct type for the respective property type. The Atoms and other properties such as Private/Extends has already been checked for equality or correctness.- Overrides:
- equalValuesin class- GProp<ReferenceString>
- Parameters:
- compareTo- The comparing-to property that contains the value.
- thisValue- This property value (for synchronization reasons).
- compareValue- Another property value.
- how- Flags EQC_* values for equal checking.
- Returns:
- The property not being equal, null for equal (both values null).
 
- equalsErrorsProcesses error property verification. The default processing is to verify the two error properties- pe1and- pe2for equality if- includeErrorsis 0 or 1, and returns true if the value is 2=no comparison with error properties.- Override to verify property errors for reference properties. - Overrides:
- equalsErrorsin class- GProp<ReferenceString>
- Parameters:
- pe1- The first error property, may be null.
- pe2- The second error property, may be null.
- how- Flags EQC_* values for equal checking.
- Returns:
- Equality flag depending on includeErrorsvalue.
 
- getPropertyClassGets the class wanted.- Returns:
- The property class that should be referenced.
 
- onEventSelfCalled when a property event is send to this property.- A subclass can override this method to perform appropriate processing and is not required to call - super.onEventSelf(e).- Specified by:
- onEventSelfin interface- IGProp<TARGET extends IPropCnr>
- Overrides:
- onEventSelfin class- GProp<ReferenceString>
- Parameters:
- event- The property event.
 
- onReferenceEventCalled to perform reference resolving. A property should override this method if it needs to perform reference resolving and validation.- Subclasses override this method and only subclasses extending - PropCnrneeds to call- super.onReferenceEvent(ResolveReferenceEvent event).- Overrides:
- onReferenceEventin class- GProp<ReferenceString>
- Parameters:
- event- The resolve references event.
 
- onProjectNameChangedCalled when a project name has been changed.- Parameters:
- event- The project name event.
 
- createUpdateReferenceprotected final void createUpdateReference- (PropReference ref, boolean doReCheck, ResolveReferencesEvent event) Resolves or creates the reference.- Parameters:
- ref- The property reference.
- doReCheck- Flag to ignore existing reference and re-check it for sanity.
- event- The event that triggered this request.
 
- updateReferenceCalled to establish a new reference after name change or parent-hood.
- getLookupPropReferenceCreates the reference string to look-up from the ReferenceString. Override this method for e.g. Base or Fixed Relative referencing.- Parameters:
- name- The reference name.
- Returns:
- The property reference string to look-up.
 
- setLookedUpReferenceSets the reference found that also has been validated. This method gives the opportunity for a subclass to remove e.g. the Base or Fixed Relative reference from the string start.- Parameters:
- name- The full reference.
- Returns:
- The reference to set in this property as ReferenceString.
 
- checkCreateReferenceChecks for tree to be valid in order to create the reference. If OK and reference is not created, this will be done.- Otherwise a validation is just performed. 
- onPropParentChangedCalled when parent changed.- Overrides:
- onPropParentChangedin class- GProp<ReferenceString>
- Parameters:
- oldParent- The old parent (or null if none).
- newParent- The new parent (or null if none).
 
- clearErrorprotected void clearError()Clears the property error.
- assignNotFoundErrorAssigns not found error.
- assignErrorAssigns a property error message of ERROR severity with DeleteProperty quick-fix.
- onReferenceEventpublic void onReferenceEvent- (PropReference ref, IPropReference.ReferenceChangeEvent event, GEvent triggerEvent) Called when a property reference event occurs. The events are ReferenceChangeEvent.FOUND, FOUND_WRONG_CLASS, RENAMED, MOVED, NEW_PROPERTY, BROKEN.- Specified by:
- onReferenceEventin interface- IPropReference
- Parameters:
- ref- The property reference object.
- event- The event.
- triggerEvent- The event that triggered this reference event, null for none.
 
- changeReferenceCalled to update a reference from an old name to a new name. This will set the new property value as well as to perform required refactoring operations.- Parameters:
- oldName- The old name.
- newName- The new name.
- ref- The current reference instance.
 
- onRefactoredCalled when the property is refactored. This method is called after rename of properties have been done. Override to process.- Parameters:
- oldName- The old name.
- newName- The new name.
 
- isValidpublic boolean isValid()Checks if the resolving of the reference is valid with the automatic resolving mechanism. Attempt to resolve again is always done depending on the- doResolveflag.- Returns:
- 1(one) if valid,- 0(zero) if not valid,- -1(minus one) to ignore potential problem because the property tree is loading.
 
- wouldValidateChecks if the reference would be valid if this property is attached to a root property.- Parameters:
- anyPropertyInTree- Any property attached to a root.
- Returns:
- null if it would validate, otherwise the error reason.
 
- getTargetReferenceGets the target reference also trying to resolve the reference, i.e. using automatic resolving mechanism.- Returns:
- The target reference instance, or nullif not found.
 
- getTargetReferenceGets the target reference also trying to resolve the reference, i.e. using automatic resolving mechanism.- Returns:
- The target reference instance, or nullif not found.
 
- isReferencingMultipleTargetspublic final boolean isReferencingMultipleTargets()Gets if this referencing property is of single-reference type or that can have between zero and many references.- The default is - false, i.e. one single reference.- Specified by:
- isReferencingMultipleTargetsin interface- IReferencingGProp
- Returns:
- trueif there are multiple references,- falseif there is just still one.
 
- getDirectReferencedTargetGets the single-referenced target. Referencing properties that can have multiple targets should ALWAYS return- nullfor this method and use the method- getDirectReferencedTargetSet()instead.- Specified by:
- getDirectReferencedTargetin interface- IReferencingGProp
- Returns:
- The referenced property, or nullfor none. The default is that this method returnsnullunless overridden.
 
- getDirectReferencedTargetSetGets the set of properties that this referencing property directly references. Referencing properties that only has a single target should ALWAYS return- nullfor this method and use the method- getDirectReferencedTarget()instead.- Specified by:
- getDirectReferencedTargetSetin interface- IReferencingGProp
- Returns:
- A set of properties, or nullfor none. The default is that this method returnsnullunless overridden.
 
- getReferenceStringGets the current reference string.- Returns:
- The default is to return the ReferenceStringusingGProp.getPropValue(), so it may returnnullif no value is set.
 
- paramStringReturns the parameter string representing the state of this event. This string is useful for debugging. Subclasses adds extra information to the string by preceding it with a comma followed by the extra information.- Overrides:
- paramStringin class- GProp<ReferenceString>
- Returns:
- the parameter string of this event.
 
- informResolvedprotected void informResolved()Called when the property has been resolved. Subclasses override this method to implement some behavior. The default implementation performs nothing, i.e. there is no need to call- super.informResolved().
- informErrorprotected void informError()Called when the property has an error. Subclasses override this method to implement some behavior. The default implementation performs nothing, i.e. there is no need to call- super.informError().
- informClearErrorprotected void informClearError()Called when the property has been cleared from error. Subclasses override this method to implement some behavior. The default implementation performs nothing, i.e. there is no need to call- super.informClearError().
- validateReferenceScopeCalled when the a property container has been renamed or moved in order to perform validation of the reference, e.g. if a base property has been moved out of scope. The implementor can assign or clear property errors by returning the error string.- Parameters:
- target- Target reference to validate the scope of, i.e. the referenced property.
- Returns:
- The error message, or null for valid. Default implementation returns null.
 
- getReferenceTypeGets the reference Type.- Specified by:
- getReferenceTypein interface- IPropReference
- Specified by:
- getReferenceTypein interface- IReferencingGProp
- Returns:
- The reference type, generally a value from the enum IPropReference.RefType, otherwise a static final implementation of the reference type with locale support.
 
- isReferenceValidValidates the property reference that has been looked up.- Specified by:
- isReferenceValidin interface- IPropReference
- Parameters:
- property- The property to validate.
- Returns:
- true if valid, false otherwise.