Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Generate a static initializer with JvmModelInferrer(I want to generate a static final field with a coresponding static initializer)
Generate a static initializer with JvmModelInferrer [message #1691028] Wed, 01 April 2015 16:05 Go to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
I want to generate something like that:
static final UriMatcher uriMatcher;
       static{
                  uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
	          uriMatcher.addURI(PROVIDER_NAME, "friends", FRIENDS);
       }

I know how to generate the field but not how to generate the static initializer.
Can anybody help me with this issue ?
Re: Generate a static initializer with JvmModelInferrer [message #1691033 is a reply to message #1691028] Wed, 01 April 2015 18:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
Hi,

afaik this is not possible at the moment. please file an enhancement request. meanwhile use a initializer method instead

	static final SimpleDateFormat df = initDf();

	private static SimpleDateFormat initDf() {
		SimpleDateFormat result = new SimpleDateFormat("yyyy-MM-dd");
		result.setLenient(false);
		return result;
	}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generate a static initializer with JvmModelInferrer [message #1691048 is a reply to message #1691033] Wed, 01 April 2015 20:22 Go to previous message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Thank you for this hint.
Previous Topic:How can I use JvmModelInferrer and old Generator approach in parallel
Next Topic:Deriving from XBase
Goto Forum:
  


Current Time: Sun Apr 18 07:27:50 GMT 2021

Powered by FUDForum. Page generated in 0.02209 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top