Class ClassReference
- All Implemented Interfaces:
EventListener
,IGProp<String>
,Cloneable
- Direct Known Subclasses:
EditorClassReference
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionprotected String
The required Interface, or null for none.protected String
The required annotation, or null for none.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 Summary
ModifierConstructorDescriptionprotected
Creates a Class Reference property with no name and with a null value.ClassReference
(Atom propertyAtom) Creates a Class Reference property with the specified name with a null value.ClassReference
(Atom propertyAtom, String newValue) Creates a Class Reference property with the specified name and value.Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a clone out of this property.protected boolean
equalsErrors
(PropError pe1, PropError pe2, int how) Processes error property verification.static ClassReference
getClassReference
(PropCnr pc, String id) Gets a ClassReference instance from a property.Gets the method in the loaded runtime class with the specified parameters types.Class
<?> Gets the loaded class for runtime.Gets the runtime instance of the class.<T> T
getRuntimeInstance
(Class<T> instanceClass) Gets the runtime instance of the class.protected void
initializeElement
(Element element) Called when the XML file for the property tree is serialized from properties.protected void
initializeProp
(Element element) Called to initialize the property from anElement
.protected boolean
Called upon creation of the property to check it's private state.protected void
onPrepare
(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, List<Throwable> errors) Called when the application is being prepared.protected void
Disposal of the instance.protected void
onVirtualizationCompleted
(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, boolean isPostResolve) Called when virtualization completed.boolean
setPropValue
(String newValue) Sets a new value for this property.boolean
verifyInterface
(Class<?> interfaceClass, List<Throwable> errors) Validates that the class implements an interface.protected final ClassReference
virtualize
(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace) Call this method to "virtualize" a property tree.Methods inherited from class com.iizix.prop.StringProp
appendPropValue, getPropValue0, getString, getString, getValueClasses, initializeValue, toNativeValue0, validatePropType
Methods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsObj, equalsPropValue, equalsTree, equalValues, 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, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCommunicating, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onPropInvalidateCache, onPropParentChanged, onPropTreeInitialized, onPropValueSet, onReferenceEvent, onRemoteEvent, paramString, 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, validatePropValue, verify, warning, warning, warning
Field Details
implementsInterface
The required Interface, or null for none.requiredAnnotation
The required annotation, or null for none.
Constructor Details
ClassReference
protected ClassReference()Creates a Class Reference property with no name and with a null value.ClassReference
Creates a Class Reference property with the specified name with a null value.- Parameters:
propertyAtom
- the property atom.
ClassReference
Creates a Class Reference property with the specified name and value.- Parameters:
propertyAtom
- the property atom.newValue
- the new string value for the property.
Method Details
getClassReference
Gets a ClassReference instance from a property. The IClassReferenceOwner interfaces is searched for upwards in the property tree and from there the ClassReference instance is returned.- Parameters:
pc
- The property container to start search on.id
- The ID of the ClassReference property, used when multiple are present in the container.- Returns:
- The ClassReference instance, of null if none is found.
isPropPrivateAtCreation
protected boolean isPropPrivateAtCreation()Called upon creation of the property to check it's private state. This is used by properties that are not distributed to the remote party.- Overrides:
isPropPrivateAtCreation
in classGProp<String>
- Returns:
- true, always.
equalsErrors
Processes error property verification. The default processing is to verify the two error propertiespe1
andpe2
for equality ifincludeErrors
is 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:
equalsErrors
in classGProp<String>
- 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
includeErrors
value.
clone
Creates a clone out of this property. The cloning is overridden by the super classes in order to handle cloning of its class variables appropriately.Cloning is used for "virtualization" of a property tree in the server. Client property classes will therefore throw
CloneNotSupportedException
.Once a tree has been cloned, the change-flag is reset, and the create-flag is set. All listeners are also removed! The new cloned property is an orphan, i.e. has no parent set.
Note that the cloning process is done WITHOUT thread synchronization for performance reasons, thus no modifications should be done to the tree!
- Overrides:
clone
in classStringProp
- Returns:
- A new cloned String property.
setPropValue
Sets 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.- Overrides:
setPropValue
in classStringProp
- Parameters:
newValue
- the new value.- Returns:
- boolean true for value has changed, false for same value as current value.
initializeElement
Called when the XML file for the property tree is serialized from properties. The property should fill attributes and nodes with appropriate information.- Overrides:
initializeElement
in classGProp<String>
- Parameters:
element
- TheElement
to initialize.
initializeProp
Called to initialize the property from anElement
. The property should initialize itself from attributes and nodes with appropriate information.- Overrides:
initializeProp
in classGProp<String>
- Parameters:
element
- TheElement
.- Throws:
PropException
- when the initialization fails.
onPrepare
protected void onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, List<Throwable> errors) throws PropException Called when the application is being prepared. The order ofonPrepare
calls is always parent first, the children. The method is called twice, first time withisPostCall
set tofalse
, then a second time withtrue
.- Overrides:
onPrepare
in classGProp<String>
- Parameters:
appOwner
- The application owner.moduleOwner
- The Module owner.isPostCall
- Flag indicating this is a post-call.errors
- A list of errors that occurred but did not cause an abort.- Throws:
PropException
- For property errors during the application preparation to need to abort.
virtualize
protected final ClassReference virtualize(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace) throws CloneNotSupportedException, PropException Call this method to "virtualize" a property tree. This method is used at runtime in the Server for the application session of virtual instances of VirtualSpace, but also virtual instances of panels, for the individual client session. The VirtualSpace is virtualized once for the application session and is shared for parallel client sessions.This method is similar to cloning, but enables references that are already resolved to remain if they point to a shared instance, e.g. the VirtualSpace pointing to its participants in the application property container shared instance, or a panel with references to text IDs, assets, etc.
- Overrides:
virtualize
in classGProp<String>
- Parameters:
appGyro
- The application gyro instance performing the virtualization.clientGyro
- The client gyro session, can benull
if not initialized from the client gyro.virtualSpace
- The virtualized VirtualSpace.- Returns:
- The virtualized property.
- Throws:
CloneNotSupportedException
- If a subclass doesn't allow cloning, e.g. the client properties.PropException
- For property errors during the virtualization.
onVirtualizationCompleted
protected void onVirtualizationCompleted(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, boolean isPostResolve) Called when virtualization completed.This method is called to the entire tree of the newly virtualized property container.
- Overrides:
onVirtualizationCompleted
in classGProp<String>
- Parameters:
appGyro
- The application gyro instance performing the virtualization.clientGyro
- The client gyro session, can benull
if not initialized from the client gyro.virtualSpace
- The virtualized VirtualSpace.isPostResolve
- Flag indicating this call is done after references are attempted to be resolved.
getMethod
Gets the method in the loaded runtime class with the specified parameters types.- Parameters:
methodName
- The method name.errors
- A list of errors that occurred but did not cause an abort.parameterTypes
- The list of parameters.- Returns:
- The method loaded, or
null
if not found (and the error is added to the list).
getRuntimeClass
Gets the loaded class for runtime.- Returns:
- The loaded class, or
null
for none.
getRuntimeInstance
Gets the runtime instance of the class.- Returns:
- The instance that was created during virtualization, or
null
if there is no loaded class for this reference or if virtualization has not taken place.
getRuntimeInstance
Gets the runtime instance of the class.- Parameters:
instanceClass
- The class the runtime instance should be assignable from.- Returns:
- The instance that was created during virtualization, or
null
if there is no loaded class for this reference or if virtualization has not taken place. It is alsonull
if the instance is not an instance of the specified classinstanceClass
.
onPropDispose
protected void onPropDispose()Disposal of the instance.- Overrides:
onPropDispose
in classGProp<String>
verifyInterface
Validates that the class implements an interface. This method is generally called during the "prepare" phase of the application.- Returns:
- true if the runtime class is defined and implements the interface, false otherwise. When a defined class does not implement the interface, an error is added.