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: 14665
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;
	}


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: Thu Apr 18 05:12:38 GMT 2024

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

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

Back to the top