| /***************************************************************************** |
| * Copyright (c) 2019 CEA LIST. |
| * |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Xavier Le Pallec (for CEA LIST) xlepallec@lilo.org - Bug 558456 |
| * |
| *****************************************************************************/ |
| |
| package org.eclipse.papyrus.uml.diagram.clazz.lf.classtextualedition.mapping; |
| |
| import org.eclipse.papyrus.uml.diagram.clazz.lf.classtextualedition.factory.BasicFactory; |
| import org.eclipse.uml2.uml.Class; |
| import org.eclipse.uml2.uml.Operation; |
| import org.eclipse.uml2.uml.Property; |
| |
| public class TypesFactory extends BasicFactory { |
| |
| private static TypesFactory instance; |
| |
| private TypesFactory() { |
| // to prevent instanciation |
| } |
| |
| /** |
| * This method returns the instance (singleton) to use as a factory. |
| * |
| * @return instance/factory |
| */ |
| public static TypesFactory getInstance() { |
| if (instance == null) { |
| instance = new TypesFactory(); |
| } |
| return instance; |
| } |
| |
| public TypeHelper createTypeHelper(Class clazz) { |
| Object[] arguments = { clazz, "clazz" }; //$NON-NLS-1$ |
| if (checkNullArgument(arguments)) { |
| return null; |
| } |
| |
| return new TypeHelper(clazz); |
| } |
| |
| public TypeHelper createTypeHelper(Property property) { |
| Object[] arguments = { property, "property" }; //$NON-NLS-1$ |
| if (checkNullArgument(arguments)) { |
| return null; |
| } |
| |
| return new TypeHelper(property); |
| } |
| |
| public TypeHelper createTypeHelper(Operation operation) { |
| Object[] arguments = { operation, "operation" }; //$NON-NLS-1$ |
| if (checkNullArgument(arguments)) { |
| return null; |
| } |
| |
| return new TypeHelper(operation); |
| } |
| |
| } |