Class ClassReference
- java.lang.Object
- com.iizix.prop.GProp<java.lang.String>
- com.iizix.prop.StringProp
- com.iizix.prop.ClassReference
 
 
 
- All Implemented Interfaces:
- EventListener,- IGProp<java.lang.String>,- java.lang.Cloneable
 - Direct Known Subclasses:
- EditorClassReference
 - public class ClassReference extends StringProp The Class Reference property class hold the reference to a Java class. It includes support for Java Refactoring in Eclipse as well as Reference Validation.- Author:
- Christopher Mindus
 
- Field Summary- Fields - Modifier and Type - Field - Description - protected java.lang.String- implementsInterfaceThe required Interface, or null for none.- protected java.lang.String- requiredAnnotationThe 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_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- Constructors - Modifier - Constructor - Description - protected- ClassReference()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, java.lang.String newValue)Creates a Class Reference property with the specified name and value.
 - Method Summary- All Methods Static Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - ClassReference- clone()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, java.lang.String id)Gets a ClassReference instance from a property.- java.lang.reflect.Method- getMethod(java.lang.String methodName, java.util.List<java.lang.Throwable> errors, java.lang.Class<?>... parameterTypes)Gets the method in the loaded runtime class with the specified parameters types.- java.lang.Class<?>- getRuntimeClass()Gets the loaded class for runtime.- java.lang.Object- getRuntimeInstance()Gets the runtime instance of the class.- <T> T- getRuntimeInstance(java.lang.Class<T> instanceClass)Gets the runtime instance of the class.- protected void- initializeElement(org.w3c.dom.Element element)Called when the XML file for the property tree is serialized from properties.- protected void- initializeProp(org.w3c.dom.Element element)Called to initialize the property from an- Element.- protected boolean- isPropPrivateAtCreation()Called upon creation of the property to check it's private state.- protected void- onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, java.util.List<java.lang.Throwable> errors)Called when the application is being prepared.- protected void- onPropDispose()Disposal of the instance.- protected void- onVirtualizationCompleted(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, boolean isPostResolve)Called when virtualization completed.- boolean- setPropValue(java.lang.String newValue)Sets a new value for this property.- boolean- verifyInterface(java.lang.Class<?> interfaceClass, java.util.List<java.lang.Throwable> errors)Validates that the class implements an interface.- protected GProp<?>- virtualize(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp)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, convertPropError, dispose, equals, equals, equalsObj, equalsPropValue, equalsTree, equalValues, extendsClone, 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, getReferences, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParent, getTreeLock, getVSReference, hasChanged, 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, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, list, list, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onPropInvalidateCache, onPropParentChanged, onPropTreeInitialized, onPropValueSet, onReferenceEvent, onRemoteEvent, onVirtualized, 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, verifyHasPropertyItem, warning, warning, warning
 
 
- Constructor Detail- ClassReference- protected ClassReference() Creates a Class Reference property with no name and with a null value.
 - ClassReference- public ClassReference(Atom propertyAtom) Creates a Class Reference property with the specified name with a null value.- Parameters:
- propertyAtom- the property atom.
 
 - ClassReference- public ClassReference(Atom propertyAtom, java.lang.String newValue) 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 Detail- getClassReference- public static ClassReference getClassReference(PropCnr pc, java.lang.String id) 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:
- isPropPrivateAtCreationin class- GProp<java.lang.String>
- Returns:
- true, always.
 
 - equalsErrors- protected boolean equalsErrors(PropError pe1, PropError pe2, int how) Processes 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<java.lang.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 includeErrorsvalue.
 
 - clone- public ClassReference 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:
- clonein class- StringProp
- Returns:
- A new cloned String property.
 
 - setPropValue- public boolean setPropValue(java.lang.String newValue) 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:
- setPropValuein class- StringProp
- Parameters:
- newValue- the new value.
- Returns:
- boolean true for value has changed, false for same value as current value.
 
 - initializeElement- protected void initializeElement(org.w3c.dom.Element element) Called when the XML file for the property tree is serialized from properties. The property should fill attributes and nodes with appropriate information.- Overrides:
- initializeElementin class- GProp<java.lang.String>
- Parameters:
- element- The- Elementto initialize.
 
 - initializeProp- protected void initializeProp(org.w3c.dom.Element element) throws PropExceptionCalled to initialize the property from an- Element. The property should initialize itself from attributes and nodes with appropriate information.- Overrides:
- initializePropin class- GProp<java.lang.String>
- Parameters:
- element- The- Element.
- Throws:
- PropException- when the initialization fails.
 
 - onPrepare- protected void onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, java.util.List<java.lang.Throwable> errors) throws PropException Called when the application is being prepared. The order of- onPreparecalls is always parent first, the children. The method is called twice, first time with- isPostCallset to- false, then a second time with- true.- Overrides:
- onPreparein class- GProp<java.lang.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 GProp<?> virtualize(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp) throws java.lang.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. - It is up to the property class to handle this by overriding this method. - Overrides:
- virtualizein class- GProp<java.lang.String>
- Parameters:
- appGyro- The application gyro instance performing the virtualization.
- clientGyro- The client gyro session, can be- nullif not initialized from the client gyro.
- virtualSpace- The virtualized VirtualSpace.
- virtualizedProp- The property being virtualized.
- Returns:
- The virtualized property.
- Throws:
- java.lang.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, PropCnr virtualizedProp, boolean isPostResolve) Called when virtualization completed.- This method is called to the entire tree of the newly virtualized property container. - Overrides:
- onVirtualizationCompletedin class- GProp<java.lang.String>
- Parameters:
- appGyro- The application gyro instance performing the virtualization.
- clientGyro- The client gyro session, can be- nullif not initialized from the client gyro.
- virtualSpace- The virtualized VirtualSpace.
- virtualizedProp- The property being virtualized.
- isPostResolve- Flag indicating this call is done after references are attempted to be resolved.
 
 - getMethod- public java.lang.reflect.Method getMethod(java.lang.String methodName, java.util.List<java.lang.Throwable> errors, java.lang.Class<?>... parameterTypes)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- public java.lang.Class<?> getRuntimeClass() Gets the loaded class for runtime.- Returns:
- The loaded class, or null for none.
 
 - getRuntimeInstance- public java.lang.Object 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- public <T> T getRuntimeInstance(java.lang.Class<T> instanceClass) 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 also null if the instance is not an instance of the specified class instanceClass.
 
 - onPropDispose- protected void onPropDispose() Disposal of the instance.- Overrides:
- onPropDisposein class- GProp<java.lang.String>
 
 - verifyInterface- public boolean verifyInterface(java.lang.Class<?> interfaceClass, java.util.List<java.lang.Throwable> errors)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.