001// license-header java merge-point
002//
003// Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
004//
005package org.andromda.metafacades.uml14;
006
007import java.util.Collection;
008import org.andromda.core.metafacade.MetafacadeBase;
009import org.andromda.core.metafacade.ModelValidationMessage;
010import org.andromda.metafacades.uml.AssociationEndFacade;
011import org.andromda.metafacades.uml.AssociationFacade;
012import org.andromda.metafacades.uml.ClassifierFacade;
013import org.andromda.translation.ocl.validation.OCLCollections;
014import org.andromda.translation.ocl.validation.OCLIntrospector;
015import org.andromda.translation.ocl.validation.OCLResultEnsurer;
016import org.apache.log4j.Logger;
017import org.omg.uml.foundation.core.AssociationEnd;
018
019/**
020 * A property related by memberEnd or its specializations to an association represents an end of the
021 * association. The type of the property is the type of the end of the association .Property
022 * represents a declared state of one or more instances in terms of a named relationship to a value
023 * or values. When a property is an association end, the value or values are related to the instance
024 * or instances at the other end(s) of the association.
025 * MetafacadeLogic for AssociationEndFacade
026 *
027 * @see AssociationEndFacade
028 */
029public abstract class AssociationEndFacadeLogic
030    extends ModelElementFacadeLogicImpl
031    implements AssociationEndFacade
032{
033    /**
034     * The underlying UML object
035     * @see AssociationEnd
036     */
037    protected AssociationEnd metaObject;
038
039    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
040     * @param metaObjectIn
041     * @param context
042     */
043    protected AssociationEndFacadeLogic(AssociationEnd metaObjectIn, String context)
044    {
045        super(metaObjectIn, getContext(context));
046        this.metaObject = metaObjectIn;
047    }
048
049    /**
050     * The logger instance.
051     */
052    private static final Logger logger = Logger.getLogger(AssociationEndFacadeLogic.class);
053
054    /**
055     * Gets the context for this metafacade logic instance.
056     * @param context String. Set to AssociationEndFacade if null
057     * @return context String
058     */
059    private static String getContext(String context)
060    {
061        if (context == null)
062        {
063            context = "org.andromda.metafacades.uml.AssociationEndFacade";
064        }
065        return context;
066    }
067
068    /** Reset context only for non-root metafacades
069     * @param context
070     */
071    @Override
072    public void resetMetafacadeContext(String context)
073    {
074        if (!this.contextRoot) // reset context only for non-root metafacades
075        {
076            context = getContext(context);  // to have same value as in original constructor call
077            setMetafacadeContext (context);
078        }
079    }
080
081    /**
082     * @return boolean true always
083     * @see AssociationEndFacade
084     */
085    public boolean isAssociationEndFacadeMetaType()
086    {
087        return true;
088    }
089
090    // --------------- attributes ---------------------
091
092   /**
093    * @see AssociationEndFacade#isOne2One()
094    * @return boolean
095    */
096    protected abstract boolean handleIsOne2One();
097
098    private boolean __one2One1a;
099    private boolean __one2One1aSet = false;
100
101    /**
102     * True if this association end's and the other end's multiplicities are both one.
103     * @return (boolean)handleIsOne2One()
104     */
105    public final boolean isOne2One()
106    {
107        boolean one2One1a = this.__one2One1a;
108        if (!this.__one2One1aSet)
109        {
110            // one2One has no pre constraints
111            one2One1a = handleIsOne2One();
112            // one2One has no post constraints
113            this.__one2One1a = one2One1a;
114            if (isMetafacadePropertyCachingEnabled())
115            {
116                this.__one2One1aSet = true;
117            }
118        }
119        return one2One1a;
120    }
121
122   /**
123    * @see AssociationEndFacade#isOne2Many()
124    * @return boolean
125    */
126    protected abstract boolean handleIsOne2Many();
127
128    private boolean __one2Many2a;
129    private boolean __one2Many2aSet = false;
130
131    /**
132     * True if this association end's multiplicity is one while the other end's is many.
133     * @return (boolean)handleIsOne2Many()
134     */
135    public final boolean isOne2Many()
136    {
137        boolean one2Many2a = this.__one2Many2a;
138        if (!this.__one2Many2aSet)
139        {
140            // one2Many has no pre constraints
141            one2Many2a = handleIsOne2Many();
142            // one2Many has no post constraints
143            this.__one2Many2a = one2Many2a;
144            if (isMetafacadePropertyCachingEnabled())
145            {
146                this.__one2Many2aSet = true;
147            }
148        }
149        return one2Many2a;
150    }
151
152   /**
153    * @see AssociationEndFacade#isMany2One()
154    * @return boolean
155    */
156    protected abstract boolean handleIsMany2One();
157
158    private boolean __many2One3a;
159    private boolean __many2One3aSet = false;
160
161    /**
162     * True if this association end's multiplicity is many while the other end's is one.
163     * @return (boolean)handleIsMany2One()
164     */
165    public final boolean isMany2One()
166    {
167        boolean many2One3a = this.__many2One3a;
168        if (!this.__many2One3aSet)
169        {
170            // many2One has no pre constraints
171            many2One3a = handleIsMany2One();
172            // many2One has no post constraints
173            this.__many2One3a = many2One3a;
174            if (isMetafacadePropertyCachingEnabled())
175            {
176                this.__many2One3aSet = true;
177            }
178        }
179        return many2One3a;
180    }
181
182   /**
183    * @see AssociationEndFacade#isMany2Many()
184    * @return boolean
185    */
186    protected abstract boolean handleIsMany2Many();
187
188    private boolean __many2Many4a;
189    private boolean __many2Many4aSet = false;
190
191    /**
192     * True if this association end's and the other end's multiplicities are both many.
193     * @return (boolean)handleIsMany2Many()
194     */
195    public final boolean isMany2Many()
196    {
197        boolean many2Many4a = this.__many2Many4a;
198        if (!this.__many2Many4aSet)
199        {
200            // many2Many has no pre constraints
201            many2Many4a = handleIsMany2Many();
202            // many2Many has no post constraints
203            this.__many2Many4a = many2Many4a;
204            if (isMetafacadePropertyCachingEnabled())
205            {
206                this.__many2Many4aSet = true;
207            }
208        }
209        return many2Many4a;
210    }
211
212   /**
213    * @see AssociationEndFacade#isAggregation()
214    * @return boolean
215    */
216    protected abstract boolean handleIsAggregation();
217
218    private boolean __aggregation5a;
219    private boolean __aggregation5aSet = false;
220
221    /**
222     * True if this association end represents an aggregation relationship.
223     * @return (boolean)handleIsAggregation()
224     */
225    public final boolean isAggregation()
226    {
227        boolean aggregation5a = this.__aggregation5a;
228        if (!this.__aggregation5aSet)
229        {
230            // aggregation has no pre constraints
231            aggregation5a = handleIsAggregation();
232            // aggregation has no post constraints
233            this.__aggregation5a = aggregation5a;
234            if (isMetafacadePropertyCachingEnabled())
235            {
236                this.__aggregation5aSet = true;
237            }
238        }
239        return aggregation5a;
240    }
241
242   /**
243    * @see AssociationEndFacade#isComposition()
244    * @return boolean
245    */
246    protected abstract boolean handleIsComposition();
247
248    private boolean __composition6a;
249    private boolean __composition6aSet = false;
250
251    /**
252     * True if this association end represents a composition relationship.
253     * @return (boolean)handleIsComposition()
254     */
255    public final boolean isComposition()
256    {
257        boolean composition6a = this.__composition6a;
258        if (!this.__composition6aSet)
259        {
260            // composition has no pre constraints
261            composition6a = handleIsComposition();
262            // composition has no post constraints
263            this.__composition6a = composition6a;
264            if (isMetafacadePropertyCachingEnabled())
265            {
266                this.__composition6aSet = true;
267            }
268        }
269        return composition6a;
270    }
271
272   /**
273    * @see AssociationEndFacade#isOrdered()
274    * @return boolean
275    */
276    protected abstract boolean handleIsOrdered();
277
278    private boolean __ordered7a;
279    private boolean __ordered7aSet = false;
280
281    /**
282     * Indicates whether or not the association ends are ordered (if multiplicity is greater than
283     * 1).
284     * @return (boolean)handleIsOrdered()
285     */
286    public final boolean isOrdered()
287    {
288        boolean ordered7a = this.__ordered7a;
289        if (!this.__ordered7aSet)
290        {
291            // ordered has no pre constraints
292            ordered7a = handleIsOrdered();
293            // ordered has no post constraints
294            this.__ordered7a = ordered7a;
295            if (isMetafacadePropertyCachingEnabled())
296            {
297                this.__ordered7aSet = true;
298            }
299        }
300        return ordered7a;
301    }
302
303   /**
304    * @see AssociationEndFacade#isReadOnly()
305    * @return boolean
306    */
307    protected abstract boolean handleIsReadOnly();
308
309    private boolean __readOnly8a;
310    private boolean __readOnly8aSet = false;
311
312    /**
313     * True if the association end cannot be changed.
314     * @return (boolean)handleIsReadOnly()
315     */
316    public final boolean isReadOnly()
317    {
318        boolean readOnly8a = this.__readOnly8a;
319        if (!this.__readOnly8aSet)
320        {
321            // readOnly has no pre constraints
322            readOnly8a = handleIsReadOnly();
323            // readOnly has no post constraints
324            this.__readOnly8a = readOnly8a;
325            if (isMetafacadePropertyCachingEnabled())
326            {
327                this.__readOnly8aSet = true;
328            }
329        }
330        return readOnly8a;
331    }
332
333   /**
334    * @see AssociationEndFacade#isNavigable()
335    * @return boolean
336    */
337    protected abstract boolean handleIsNavigable();
338
339    private boolean __navigable9a;
340    private boolean __navigable9aSet = false;
341
342    /**
343     * True if it is possible to navigate from the other end to this association end .
344     * @return (boolean)handleIsNavigable()
345     */
346    public final boolean isNavigable()
347    {
348        boolean navigable9a = this.__navigable9a;
349        if (!this.__navigable9aSet)
350        {
351            // navigable has no pre constraints
352            navigable9a = handleIsNavigable();
353            // navigable has no post constraints
354            this.__navigable9a = navigable9a;
355            if (isMetafacadePropertyCachingEnabled())
356            {
357                this.__navigable9aSet = true;
358            }
359        }
360        return navigable9a;
361    }
362
363   /**
364    * @see AssociationEndFacade#getGetterName()
365    * @return String
366    */
367    protected abstract String handleGetGetterName();
368
369    private String __getterName10a;
370    private boolean __getterName10aSet = false;
371
372    /**
373     * A name suitable for use when accessing this association end in programming code.
374     * @return (String)handleGetGetterName()
375     */
376    public final String getGetterName()
377    {
378        String getterName10a = this.__getterName10a;
379        if (!this.__getterName10aSet)
380        {
381            // getterName has no pre constraints
382            getterName10a = handleGetGetterName();
383            // getterName has no post constraints
384            this.__getterName10a = getterName10a;
385            if (isMetafacadePropertyCachingEnabled())
386            {
387                this.__getterName10aSet = true;
388            }
389        }
390        return getterName10a;
391    }
392
393   /**
394    * @see AssociationEndFacade#getSetterName()
395    * @return String
396    */
397    protected abstract String handleGetSetterName();
398
399    private String __setterName11a;
400    private boolean __setterName11aSet = false;
401
402    /**
403     * A name suitable for use when accessing this association end in programming code.
404     * @return (String)handleGetSetterName()
405     */
406    public final String getSetterName()
407    {
408        String setterName11a = this.__setterName11a;
409        if (!this.__setterName11aSet)
410        {
411            // setterName has no pre constraints
412            setterName11a = handleGetSetterName();
413            // setterName has no post constraints
414            this.__setterName11a = setterName11a;
415            if (isMetafacadePropertyCachingEnabled())
416            {
417                this.__setterName11aSet = true;
418            }
419        }
420        return setterName11a;
421    }
422
423   /**
424    * @see AssociationEndFacade#getGetterSetterTypeName()
425    * @return String
426    */
427    protected abstract String handleGetGetterSetterTypeName();
428
429    private String __getterSetterTypeName12a;
430    private boolean __getterSetterTypeName12aSet = false;
431
432    /**
433     * The name of the type that is returned on the accessor and mutator operations,  determined in
434     * part by the multiplicity.
435     * @return (String)handleGetGetterSetterTypeName()
436     */
437    public final String getGetterSetterTypeName()
438    {
439        String getterSetterTypeName12a = this.__getterSetterTypeName12a;
440        if (!this.__getterSetterTypeName12aSet)
441        {
442            // getterSetterTypeName has no pre constraints
443            getterSetterTypeName12a = handleGetGetterSetterTypeName();
444            // getterSetterTypeName has no post constraints
445            this.__getterSetterTypeName12a = getterSetterTypeName12a;
446            if (isMetafacadePropertyCachingEnabled())
447            {
448                this.__getterSetterTypeName12aSet = true;
449            }
450        }
451        return getterSetterTypeName12a;
452    }
453
454   /**
455    * @see AssociationEndFacade#isMany()
456    * @return boolean
457    */
458    protected abstract boolean handleIsMany();
459
460    private boolean __many13a;
461    private boolean __many13aSet = false;
462
463    /**
464     * True if this association end's multiplicity is greater than one.
465     * @return (boolean)handleIsMany()
466     */
467    public final boolean isMany()
468    {
469        boolean many13a = this.__many13a;
470        if (!this.__many13aSet)
471        {
472            // many has no pre constraints
473            many13a = handleIsMany();
474            // many has no post constraints
475            this.__many13a = many13a;
476            if (isMetafacadePropertyCachingEnabled())
477            {
478                this.__many13aSet = true;
479            }
480        }
481        return many13a;
482    }
483
484   /**
485    * @see AssociationEndFacade#isRequired()
486    * @return boolean
487    */
488    protected abstract boolean handleIsRequired();
489
490    private boolean __required14a;
491    private boolean __required14aSet = false;
492
493    /**
494     * True if this association end's multiplicity is strictly greater than zero.
495     * @return (boolean)handleIsRequired()
496     */
497    public final boolean isRequired()
498    {
499        boolean required14a = this.__required14a;
500        if (!this.__required14aSet)
501        {
502            // required has no pre constraints
503            required14a = handleIsRequired();
504            // required has no post constraints
505            this.__required14a = required14a;
506            if (isMetafacadePropertyCachingEnabled())
507            {
508                this.__required14aSet = true;
509            }
510        }
511        return required14a;
512    }
513
514   /**
515    * @see AssociationEndFacade#isChild()
516    * @return boolean
517    */
518    protected abstract boolean handleIsChild();
519
520    private boolean __child15a;
521    private boolean __child15aSet = false;
522
523    /**
524     * Returns whether or not (true/false) this association end is the child end of the assocation
525     * (i.e. the other end's aggregation is composition).
526     * @return (boolean)handleIsChild()
527     */
528    public final boolean isChild()
529    {
530        boolean child15a = this.__child15a;
531        if (!this.__child15aSet)
532        {
533            // child has no pre constraints
534            child15a = handleIsChild();
535            // child has no post constraints
536            this.__child15a = child15a;
537            if (isMetafacadePropertyCachingEnabled())
538            {
539                this.__child15aSet = true;
540            }
541        }
542        return child15a;
543    }
544
545   /**
546    * @see AssociationEndFacade#getUpper()
547    * @return int
548    */
549    protected abstract int handleGetUpper();
550
551    private int __upper16a;
552    private boolean __upper16aSet = false;
553
554    /**
555     * the upper value for the multiplicity (will be -1 for *)
556     * -only applicable for UML2
557     * @return (int)handleGetUpper()
558     */
559    public final int getUpper()
560    {
561        int upper16a = this.__upper16a;
562        if (!this.__upper16aSet)
563        {
564            // upper has no pre constraints
565            upper16a = handleGetUpper();
566            // upper has no post constraints
567            this.__upper16a = upper16a;
568            if (isMetafacadePropertyCachingEnabled())
569            {
570                this.__upper16aSet = true;
571            }
572        }
573        return upper16a;
574    }
575
576   /**
577    * @see AssociationEndFacade#getLower()
578    * @return int
579    */
580    protected abstract int handleGetLower();
581
582    private int __lower17a;
583    private boolean __lower17aSet = false;
584
585    /**
586     * the lower value for the multiplicity
587     * -only applicable for UML2
588     * @return (int)handleGetLower()
589     */
590    public final int getLower()
591    {
592        int lower17a = this.__lower17a;
593        if (!this.__lower17aSet)
594        {
595            // lower has no pre constraints
596            lower17a = handleGetLower();
597            // lower has no post constraints
598            this.__lower17a = lower17a;
599            if (isMetafacadePropertyCachingEnabled())
600            {
601                this.__lower17aSet = true;
602            }
603        }
604        return lower17a;
605    }
606
607   /**
608    * @see AssociationEndFacade#getDefault()
609    * @return String
610    */
611    protected abstract String handleGetDefault();
612
613    private String __default18a;
614    private boolean __default18aSet = false;
615
616    /**
617     * UML2: Returns the value of the 'Default' attribute. Specifies a String that represents a
618     * value to be used when no argument is supplied for the Property. A String that is evaluated to
619     * give a default value for the Property when an object of the owning Classifier is
620     * instantiated.  Can be something like: new ValueObject(values);
621     * @return (String)handleGetDefault()
622     */
623    public final String getDefault()
624    {
625        String default18a = this.__default18a;
626        if (!this.__default18aSet)
627        {
628            // default has no pre constraints
629            default18a = handleGetDefault();
630            // default has no post constraints
631            this.__default18a = default18a;
632            if (isMetafacadePropertyCachingEnabled())
633            {
634                this.__default18aSet = true;
635            }
636        }
637        return default18a;
638    }
639
640   /**
641    * @see AssociationEndFacade#getAggregationKind()
642    * @return String
643    */
644    protected abstract String handleGetAggregationKind();
645
646    private String __aggregationKind19a;
647    private boolean __aggregationKind19aSet = false;
648
649    /**
650     * Returns the value of the 'Aggregation' attribute (none, shared, composite). The default value
651     * is "none". The literals are from the enumeration org.eclipse.uml2.uml.AggregationKind.
652     * Specifies the kind of aggregation that applies to the Property.
653     * @return (String)handleGetAggregationKind()
654     */
655    public final String getAggregationKind()
656    {
657        String aggregationKind19a = this.__aggregationKind19a;
658        if (!this.__aggregationKind19aSet)
659        {
660            // aggregationKind has no pre constraints
661            aggregationKind19a = handleGetAggregationKind();
662            // aggregationKind has no post constraints
663            this.__aggregationKind19a = aggregationKind19a;
664            if (isMetafacadePropertyCachingEnabled())
665            {
666                this.__aggregationKind19aSet = true;
667            }
668        }
669        return aggregationKind19a;
670    }
671
672   /**
673    * @see AssociationEndFacade#isLeaf()
674    * @return boolean
675    */
676    protected abstract boolean handleIsLeaf();
677
678    private boolean __leaf20a;
679    private boolean __leaf20aSet = false;
680
681    /**
682     * IsLeaf property in the association end property. If true, attribute is final, cannot be
683     * extended or implemented by a descendant. Default=false.
684     * @return (boolean)handleIsLeaf()
685     */
686    public final boolean isLeaf()
687    {
688        boolean leaf20a = this.__leaf20a;
689        if (!this.__leaf20aSet)
690        {
691            // leaf has no pre constraints
692            leaf20a = handleIsLeaf();
693            // leaf has no post constraints
694            this.__leaf20a = leaf20a;
695            if (isMetafacadePropertyCachingEnabled())
696            {
697                this.__leaf20aSet = true;
698            }
699        }
700        return leaf20a;
701    }
702
703   /**
704    * @see AssociationEndFacade#isUnique()
705    * @return boolean
706    */
707    protected abstract boolean handleIsUnique();
708
709    private boolean __unique21a;
710    private boolean __unique21aSet = false;
711
712    /**
713     * UML2: If the association attribute is unique within the Collection type. UML14 always returns
714     * false. Unique+Ordered determines the implementation Collection type. Default=false.
715     * @return (boolean)handleIsUnique()
716     */
717    public final boolean isUnique()
718    {
719        boolean unique21a = this.__unique21a;
720        if (!this.__unique21aSet)
721        {
722            // unique has no pre constraints
723            unique21a = handleIsUnique();
724            // unique has no post constraints
725            this.__unique21a = unique21a;
726            if (isMetafacadePropertyCachingEnabled())
727            {
728                this.__unique21aSet = true;
729            }
730        }
731        return unique21a;
732    }
733
734   /**
735    * @see AssociationEndFacade#getRemoverName()
736    * @return String
737    */
738    protected abstract String handleGetRemoverName();
739
740    private String __removerName22a;
741    private boolean __removerName22aSet = false;
742
743    /**
744     * A name suitable for use when removing element from this association end in programming code.
745     * @return (String)handleGetRemoverName()
746     */
747    public final String getRemoverName()
748    {
749        String removerName22a = this.__removerName22a;
750        if (!this.__removerName22aSet)
751        {
752            // removerName has no pre constraints
753            removerName22a = handleGetRemoverName();
754            // removerName has no post constraints
755            this.__removerName22a = removerName22a;
756            if (isMetafacadePropertyCachingEnabled())
757            {
758                this.__removerName22aSet = true;
759            }
760        }
761        return removerName22a;
762    }
763
764   /**
765    * @see AssociationEndFacade#getAdderName()
766    * @return String
767    */
768    protected abstract String handleGetAdderName();
769
770    private String __adderName23a;
771    private boolean __adderName23aSet = false;
772
773    /**
774     * A name suitable for use when adding new elements to this association end in programming code.
775     * @return (String)handleGetAdderName()
776     */
777    public final String getAdderName()
778    {
779        String adderName23a = this.__adderName23a;
780        if (!this.__adderName23aSet)
781        {
782            // adderName has no pre constraints
783            adderName23a = handleGetAdderName();
784            // adderName has no post constraints
785            this.__adderName23a = adderName23a;
786            if (isMetafacadePropertyCachingEnabled())
787            {
788                this.__adderName23aSet = true;
789            }
790        }
791        return adderName23a;
792    }
793
794   /**
795    * @see AssociationEndFacade#isBidirectional()
796    * @return boolean
797    */
798    protected abstract boolean handleIsBidirectional();
799
800    private boolean __bidirectional24a;
801    private boolean __bidirectional24aSet = false;
802
803    /**
804     * Is true if update of one side of the association should also update the other side. false if
805     * not.
806     * @return (boolean)handleIsBidirectional()
807     */
808    public final boolean isBidirectional()
809    {
810        boolean bidirectional24a = this.__bidirectional24a;
811        if (!this.__bidirectional24aSet)
812        {
813            // bidirectional has no pre constraints
814            bidirectional24a = handleIsBidirectional();
815            // bidirectional has no post constraints
816            this.__bidirectional24a = bidirectional24a;
817            if (isMetafacadePropertyCachingEnabled())
818            {
819                this.__bidirectional24aSet = true;
820            }
821        }
822        return bidirectional24a;
823    }
824
825   /**
826    * @see AssociationEndFacade#isDerived()
827    * @return boolean
828    */
829    protected abstract boolean handleIsDerived();
830
831    private boolean __derived25a;
832    private boolean __derived25aSet = false;
833
834    /**
835     * If the association end is derived (its value is computed). UML2 only. UML14 always returns
836     * false. Default=false.
837     * @return (boolean)handleIsDerived()
838     */
839    public final boolean isDerived()
840    {
841        boolean derived25a = this.__derived25a;
842        if (!this.__derived25aSet)
843        {
844            // derived has no pre constraints
845            derived25a = handleIsDerived();
846            // derived has no post constraints
847            this.__derived25a = derived25a;
848            if (isMetafacadePropertyCachingEnabled())
849            {
850                this.__derived25aSet = true;
851            }
852        }
853        return derived25a;
854    }
855
856   /**
857    * @see AssociationEndFacade#isStatic()
858    * @return boolean
859    */
860    protected abstract boolean handleIsStatic();
861
862    private boolean __static26a;
863    private boolean __static26aSet = false;
864
865    /**
866     * Indicates if this associationEnd is 'static', meaning it has a classifier scope.
867     * @return (boolean)handleIsStatic()
868     */
869    public final boolean isStatic()
870    {
871        boolean static26a = this.__static26a;
872        if (!this.__static26aSet)
873        {
874            // static has no pre constraints
875            static26a = handleIsStatic();
876            // static has no post constraints
877            this.__static26a = static26a;
878            if (isMetafacadePropertyCachingEnabled())
879            {
880                this.__static26aSet = true;
881            }
882        }
883        return static26a;
884    }
885
886    // ------------- associations ------------------
887
888    /**
889     * Gets the association ends belonging to this association.
890     * @return (AssociationFacade)handleGetAssociation()
891     */
892    public final AssociationFacade getAssociation()
893    {
894        AssociationFacade getAssociation1r = null;
895        // associationEnds has no pre constraints
896        Object result = handleGetAssociation();
897        MetafacadeBase shieldedResult = this.shieldedElement(result);
898        try
899        {
900            getAssociation1r = (AssociationFacade)shieldedResult;
901        }
902        catch (ClassCastException ex)
903        {
904            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
905            AssociationEndFacadeLogic.logger.warn("incorrect metafacade cast for AssociationEndFacadeLogic.getAssociation AssociationFacade " + result + ": " + shieldedResult);
906        }
907        // associationEnds has no post constraints
908        return getAssociation1r;
909    }
910
911    /**
912     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
913     * @return Object
914     */
915    protected abstract Object handleGetAssociation();
916
917    /**
918     * A property related by memberEnd or its specializations to an association represents an end of
919     * the
920     * association. The type of the property is the type of the end of the association .Property
921     * represents
922     * a declared state of one or more instances in terms of a named relationship to a value or
923     * values.
924     * When a property is an association end, the value or values are related to the instance or
925     * instances
926     * at the other end(s) of the association.
927     * @return (ClassifierFacade)handleGetType()
928     */
929    public final ClassifierFacade getType()
930    {
931        ClassifierFacade getType2r = null;
932        // associationEndFacade has no pre constraints
933        Object result = handleGetType();
934        MetafacadeBase shieldedResult = this.shieldedElement(result);
935        try
936        {
937            getType2r = (ClassifierFacade)shieldedResult;
938        }
939        catch (ClassCastException ex)
940        {
941            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
942            AssociationEndFacadeLogic.logger.warn("incorrect metafacade cast for AssociationEndFacadeLogic.getType ClassifierFacade " + result + ": " + shieldedResult);
943        }
944        // associationEndFacade has no post constraints
945        return getType2r;
946    }
947
948    /**
949     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
950     * @return Object
951     */
952    protected abstract Object handleGetType();
953
954    /**
955     * A property related by memberEnd or its specializations to an association represents an end of
956     * the
957     * association. The type of the property is the type of the end of the association .Property
958     * represents
959     * a declared state of one or more instances in terms of a named relationship to a value or
960     * values.
961     * When a property is an association end, the value or values are related to the instance or
962     * instances
963     * at the other end(s) of the association.
964     * @return (AssociationEndFacade)handleGetOtherEnd()
965     */
966    public final AssociationEndFacade getOtherEnd()
967    {
968        AssociationEndFacade getOtherEnd3r = null;
969        // associationEndFacade has no pre constraints
970        Object result = handleGetOtherEnd();
971        MetafacadeBase shieldedResult = this.shieldedElement(result);
972        try
973        {
974            getOtherEnd3r = (AssociationEndFacade)shieldedResult;
975        }
976        catch (ClassCastException ex)
977        {
978            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
979            AssociationEndFacadeLogic.logger.warn("incorrect metafacade cast for AssociationEndFacadeLogic.getOtherEnd AssociationEndFacade " + result + ": " + shieldedResult);
980        }
981        // associationEndFacade has no post constraints
982        return getOtherEnd3r;
983    }
984
985    /**
986     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
987     * @return Object
988     */
989    protected abstract Object handleGetOtherEnd();
990
991    /**
992     * <p><b>Constraint:</b> org::andromda::metafacades::uml::AssociationEndFacade::association end needs a type</p>
993     * <p><b>Error:</b> Each association end needs a type, you cannot leave the type unspecified.</p>
994     * <p><b>OCL:</b> context AssociationEndFacade
995inv: type.name->notEmpty()</p>
996     * @param validationMessages Collection<ModelValidationMessage>
997     * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
998     */
999    @Override
1000    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
1001    {
1002        super.validateInvariants(validationMessages);
1003        try
1004        {
1005            final Object contextElement = this.THIS();
1006            boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"type.name")));
1007            if (!constraintValid)
1008            {
1009                validationMessages.add(
1010                    new ModelValidationMessage(
1011                        (MetafacadeBase)contextElement ,
1012                        "org::andromda::metafacades::uml::AssociationEndFacade::association end needs a type",
1013                        "Each association end needs a type, you cannot leave the type unspecified."));
1014            }
1015        }
1016        catch (Throwable th)
1017        {
1018            Throwable cause = th.getCause();
1019            int depth = 0; // Some throwables have infinite recursion
1020            while (cause != null && depth < 7)
1021            {
1022                th = cause;
1023                depth++;
1024            }
1025            logger.error("Error validating constraint 'org::andromda::metafacades::uml::AssociationEndFacade::association end needs a type' ON "
1026                + this.THIS().toString() + ": " + th.getMessage(), th);
1027        }
1028    }
1029}