Class AbstractBaseRelativeReference<TARGET extends IPropCnr>

java.lang.Object
com.iizix.prop.GProp<ReferenceString>
com.iizix.prop.AbstractReference<TARGET>
com.iizix.prop.AbstractBaseRelativeReference<TARGET>
All Implemented Interfaces:
EventListener, IGProp<ReferenceString>, IPropReference, IReferencingGProp, Cloneable
Direct Known Subclasses:
AbstractUICompRelativeReference

public abstract class AbstractBaseRelativeReference<TARGET extends IPropCnr> extends AbstractReference<TARGET>
The Base Relative Reference property class hold the reference to another property in the same base container.

This relative referencing can be done with acceptance of different types of classes. When constructing the relative reference, the PropCnr must be set.

Author:
Christopher Mindus
  • Constructor Details

    • AbstractBaseRelativeReference

      protected AbstractBaseRelativeReference()
      Creates a Base Relative Reference property with no name and with a null value.
    • AbstractBaseRelativeReference

      public AbstractBaseRelativeReference(Atom propertyAtom)
      Creates a Base Relative Reference property with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
    • AbstractBaseRelativeReference

      public AbstractBaseRelativeReference(Atom propertyAtom, String newValue)
      Creates a Base Relative Reference property with the specified name and value.
      Parameters:
      propertyAtom - the property atom.
      newValue - the new string value for the property.
  • Method Details

    • doPostResolve

      protected boolean doPostResolve()
      Returns if resolving of this reference should be done in post- (true) or pre-stage (false).
      Overrides:
      doPostResolve in class AbstractReference<TARGET extends IPropCnr>
      Returns:
      true by default, i.e. in post-mode once main references are resolved.
    • getLookupPropReference

      protected String getLookupPropReference(ReferenceString name)
      Creates the reference string to look-up from the ReferenceString. Override this method for e.g. Base or Fixed Relative referencing.
      Overrides:
      getLookupPropReference in class AbstractReference<TARGET extends IPropCnr>
      Parameters:
      name - The reference name.
      Returns:
      The property reference string to look-up.
    • setLookedUpReference

      protected String setLookedUpReference(String name)
      Sets 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.
      Overrides:
      setLookedUpReference in class AbstractReference<TARGET extends IPropCnr>
      Parameters:
      name - The full reference.
      Returns:
      The reference to set in this property as ReferenceString.
    • validateReferenceScope

      protected String validateReferenceScope(TARGET property)
      Called 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.
      Overrides:
      validateReferenceScope in class AbstractReference<TARGET extends IPropCnr>
      Parameters:
      property - Property to validate the scope of, i.e. the referenced property.
      Returns:
      The error message, or null for valid. Default implementation returns null.
    • getReferenceString

      protected String getReferenceString(IPropCnr cnr)
      Gets the reference string for a property container.

      An overriding method might convert the reference from e.g. old full path format for UI to the short UI reference format.

      Parameters:
      cnr - The container reference, might be null for none.
      Returns:
      The default is to return IGProp.getReferencePropName(), but e.g. for UI, it may be overridden, null if cnr is null.
    • getScopeErrorMessage

      protected String getScopeErrorMessage(TARGET property, PropCnr base)
      Gets the error message when the base container doesn't validate scope. Override to produce a better error message for the specialized reference implementation.
      Parameters:
      property - The property being targeted.
      base - The base property reference.
      Returns:
      "Target reference is not a child of the base property container".