blob: c88c2dac6bc654ac3edfd8d5f085bf7b11c8ce71 [file] [log] [blame]
[comment encoding = UTF-8 /]
[comment
/*******************************************************************************
* Copyright (c) 2018 Jad El-khoury.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
*
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
*
* Jad El-khoury - initial implementation
*******************************************************************************/
/]
[module generateVocabularyConstants('http://org.eclipse.lyo/oslc4j/adaptorInterface', 'http://org.eclipse.lyo/oslc4j/vocabulary')]
[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::vocabularyServices/]
[template public generateClassConstants(aClass : Class)]
public static String [classConstantName(aClass)/] = "[aClass.javaName(true)/]";
public static String [classTypeConstantName(aClass)/] = [vocabularyNamespaceConstantName(aClass.definingVocabulary())/] + [classConstantName(aClass)/];
[/template]
[template public generateVocabularyConstants(aVocabulary: Vocabulary, anAdaptorInterface : AdaptorInterface, defaultJavaFilesPath : String, defaultJavaClassPackageName : String)]
[file (javaInterfaceFullFileNameForConstants(aVocabulary, anAdaptorInterface, defaultJavaFilesPath, defaultJavaClassPackageName), false, 'UTF-8')]
// [protected ('Copyright')]
/*******************************************************************************
* Copyright (c) 2018 Jad El-khoury.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
*
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
*
* Jad El-khoury initial implementation
*
* This file is generated by org.eclipse.lyo.oslc4j.codegenerator
*******************************************************************************/
// [/protected]
package [javaInterfacePackageNameForConstants(aVocabulary, anAdaptorInterface, defaultJavaClassPackageName) /];
import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
// [protected ('imports')]
// [/protected]
public interface [javaInterfaceNameForConstants(aVocabulary) /]
{
// [protected ('user constants')]
// [/protected]
public static String [vocabularyNamespaceConstantName(aVocabulary)/] = "[aVocabulary.namespaceURI/]";
public static String [vocabularyPreferredNamespacePrefixConstantName(aVocabulary)/] = "[aVocabulary.preferredNamespacePrefix/]";
[for (aClass: Class | aVocabulary.classes->sortedBy(name))]
[generateClassConstants(aClass) /]
[/for]
}
[/file]
[/template]