org.faktorips.runtime.internal
Class ProductComponentLink<T extends IProductComponent>

java.lang.Object
  extended by org.faktorips.runtime.internal.RuntimeObject
      extended by org.faktorips.runtime.internal.ProductComponentLink<T>
All Implemented Interfaces:
IClRepositoryObject, IXmlPersistenceSupport, IProductComponentLink<T>, IRuntimeObject

public class ProductComponentLink<T extends IProductComponent>
extends RuntimeObject
implements IProductComponentLink<T>, IXmlPersistenceSupport

Class that represents a link/relation between product components.

As of FIPS 3.2 the cardinalities standard OPTIONAL, OBLIGATORY and FULL_RANGE are provided by the CardinalityRange class.

Author:
Daniel Hohenberger
See Also:
CardinalityRange

Constructor Summary
ProductComponentLink(IProductComponentGeneration source)
          Creates a new link for the given product component generation.
ProductComponentLink(IProductComponentGeneration source, T target)
          Creates a new link to the given target for the given product component generation using the cardinality (0,*).
ProductComponentLink(IProductComponentGeneration source, T target, CardinalityRange cardinality)
          Creates a new link with the given cardinality to the given target for the given product component generation.
ProductComponentLink(IProductComponentLinkSource source)
          Creates a new link for the given product component generation.
ProductComponentLink(IProductComponentLinkSource source, T target)
          Creates a new link to the given target for the given product component generation using the cardinality (0,*).
ProductComponentLink(IProductComponentLinkSource source, T target, CardinalityRange cardinality)
          Creates a new link with the given cardinality to the given target for the given product component generation.
 
Method Summary
 String getAssociationName()
          Returns the name of the association this link belongs to.
 CardinalityRange getCardinality()
           
 IProductComponentLinkSource getSource()
          Returns the IProductComponentLinkSource this link originates from.
 T getTarget()
          Returns the target product component.
 String getTargetId()
          Returns the target product component's id.
 void initFromXml(Element element)
          Initializes this object with the data stored in the XML element.
 String toString()
           
 Element toXml(Document document)
          Creates an Element (using the given document) that represents this object in XML.
 
Methods inherited from class org.faktorips.runtime.internal.RuntimeObject
getExtensionPropertyIds, getExtensionPropertyValue, initExtensionPropertiesFromXml, writeExtensionPropertiesToXml, writeExtensionPropertiesToXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.faktorips.runtime.IRuntimeObject
getExtensionPropertyIds, getExtensionPropertyValue
 

Constructor Detail

ProductComponentLink

public ProductComponentLink(IProductComponentGeneration source)
Creates a new link for the given product component generation. Target and cardinality must be set by invoking initFromXml.


ProductComponentLink

public ProductComponentLink(IProductComponentGeneration source,
                            T target)
Creates a new link to the given target for the given product component generation using the cardinality (0,*).

Throws:
NullPointerException - if any of the parameters is null.

ProductComponentLink

public ProductComponentLink(IProductComponentGeneration source,
                            T target,
                            CardinalityRange cardinality)
Creates a new link with the given cardinality to the given target for the given product component generation.

Throws:
NullPointerException - if any of the parameters is null.

ProductComponentLink

public ProductComponentLink(IProductComponentLinkSource source)
Creates a new link for the given product component generation. Target and cardinality must be set by invoking initFromXml.


ProductComponentLink

public ProductComponentLink(IProductComponentLinkSource source,
                            T target)
Creates a new link to the given target for the given product component generation using the cardinality (0,*).

Throws:
NullPointerException - if any of the parameters is null.

ProductComponentLink

public ProductComponentLink(IProductComponentLinkSource source,
                            T target,
                            CardinalityRange cardinality)
Creates a new link with the given cardinality to the given target for the given product component generation.

Throws:
NullPointerException - if any of the parameters is null.
Method Detail

getCardinality

public CardinalityRange getCardinality()
Specified by:
getCardinality in interface IProductComponentLink<T extends IProductComponent>
Returns:
this link's min and max cardinality as a IntegerRange.

initFromXml

public void initFromXml(Element element)
Description copied from interface: IClRepositoryObject
Initializes this object with the data stored in the XML element.

Specified by:
initFromXml in interface IClRepositoryObject

toXml

public Element toXml(Document document)
Description copied from interface: IXmlPersistenceSupport
Creates an Element (using the given document) that represents this object in XML. The caller is responsible of adding the returned element to an other Element or Document if required.

Specified by:
toXml in interface IXmlPersistenceSupport
Parameters:
document - the document to use for creating Elements
Returns:
an Element that represents this object as XML element

getTarget

public T getTarget()
Description copied from interface: IProductComponentLink
Returns the target product component.

Specified by:
getTarget in interface IProductComponentLink<T extends IProductComponent>

getTargetId

public String getTargetId()
Description copied from interface: IProductComponentLink
Returns the target product component's id.

Specified by:
getTargetId in interface IProductComponentLink<T extends IProductComponent>

getAssociationName

public String getAssociationName()
Description copied from interface: IProductComponentLink
Returns the name of the association this link belongs to.

Specified by:
getAssociationName in interface IProductComponentLink<T extends IProductComponent>

toString

public String toString()
Overrides:
toString in class Object

getSource

public IProductComponentLinkSource getSource()
Description copied from interface: IProductComponentLink
Returns the IProductComponentLinkSource this link originates from. This may be a IProductComponentGeneration or a IProductComponent (since 3.8).

Specified by:
getSource in interface IProductComponentLink<T extends IProductComponent>


Copyright © 2015. All rights reserved.