JavaTypeSystemAccess.xtend 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Copyright (c) 2012 committers of YAKINDU and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * committers of YAKINDU - initial API and implementation
  10. */
  11. package org.yakindu.sct.generator.java.types
  12. import com.google.inject.Inject
  13. import org.yakindu.base.types.ITypeSystem
  14. import org.yakindu.base.types.Type
  15. import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess
  16. /**
  17. * @author andreas muelder
  18. * @author Alexander Nyßen - Adopted to type system changes
  19. */
  20. class JavaTypeSystemAccess implements ICodegenTypeSystemAccess {
  21. @Inject
  22. private extension ITypeSystem ts
  23. override String getTargetLanguageName(Type type) {
  24. switch (type) {
  25. case type == null || isVoidType(type): "void"
  26. case isRealType(type): "double"
  27. case isIntegerType(type): "long"
  28. case isBooleanType(type): "boolean"
  29. case isStringType(type): "String"
  30. default: "//" + this
  31. };
  32. }
  33. }