001/** 002 * Copyright 2014 The Sculptor Project Team, including the original 003 * author or authors. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.sculptor.generator.cartridge.builder; 018 019import org.sculptor.generator.cartridge.builder.BuilderTmpl; 020import sculptormetamodel.Attribute; 021import sculptormetamodel.DomainObject; 022import sculptormetamodel.NamedElement; 023import sculptormetamodel.Reference; 024 025/** 026 * Method dispatch class for BuilderTmpl, used for dispatching to overrideable methods 027 */ 028@SuppressWarnings("all") 029public class BuilderTmplMethodDispatch extends BuilderTmpl { 030 public BuilderTmplMethodDispatch(final BuilderTmpl[] methodsDispatchTable) { 031 super(null); 032 this.methodsDispatchTable = methodsDispatchTable; 033 } 034 035 public BuilderTmplMethodDispatch(final BuilderTmpl next, final BuilderTmpl[] methodsDispatchTable) { 036 super(next); 037 this.methodsDispatchTable = methodsDispatchTable; 038 } 039 040 private final BuilderTmpl[] methodsDispatchTable; 041 042 public final BuilderTmpl[] getMethodsDispatchTable() { 043 return(methodsDispatchTable); 044 } 045 046 public String builder(final DomainObject it) { 047 BuilderTmpl nextObj = methodsDispatchTable[org.sculptor.generator.cartridge.builder.BuilderTmplMethodIndexes.BUILDER_DOMAINOBJECT]; 048 return nextObj._chained_builder(it); 049 } 050 051 public String builderBody(final DomainObject it) { 052 BuilderTmpl nextObj = methodsDispatchTable[org.sculptor.generator.cartridge.builder.BuilderTmplMethodIndexes.BUILDERBODY_DOMAINOBJECT]; 053 return nextObj._chained_builderBody(it); 054 } 055 056 public String assignAttributeInConstructor(final NamedElement it) { 057 BuilderTmpl nextObj = methodsDispatchTable[org.sculptor.generator.cartridge.builder.BuilderTmplMethodIndexes.ASSIGNATTRIBUTEINCONSTRUCTOR_NAMEDELEMENT]; 058 return nextObj._chained_assignAttributeInConstructor(it); 059 } 060 061 public String multiReferenceAdd(final Reference it, final DomainObject obj) { 062 BuilderTmpl nextObj = methodsDispatchTable[org.sculptor.generator.cartridge.builder.BuilderTmplMethodIndexes.MULTIREFERENCEADD_REFERENCE_DOMAINOBJECT]; 063 return nextObj._chained_multiReferenceAdd(it, obj); 064 } 065 066 public String builderAttribute(final Attribute it) { 067 BuilderTmpl nextObj = methodsDispatchTable[org.sculptor.generator.cartridge.builder.BuilderTmplMethodIndexes.BUILDERATTRIBUTE_ATTRIBUTE]; 068 return nextObj._chained_builderAttribute(it); 069 } 070 071 public String builderAttributeSetter(final Attribute it, final DomainObject obj) { 072 BuilderTmpl nextObj = methodsDispatchTable[org.sculptor.generator.cartridge.builder.BuilderTmplMethodIndexes.BUILDERATTRIBUTESETTER_ATTRIBUTE_DOMAINOBJECT]; 073 return nextObj._chained_builderAttributeSetter(it, obj); 074 } 075 076 public String builderSingleReferenceSetter(final Reference it, final DomainObject obj) { 077 BuilderTmpl nextObj = methodsDispatchTable[org.sculptor.generator.cartridge.builder.BuilderTmplMethodIndexes.BUILDERSINGLEREFERENCESETTER_REFERENCE_DOMAINOBJECT]; 078 return nextObj._chained_builderSingleReferenceSetter(it, obj); 079 } 080}