This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Commander { | |
static val log = Logger.getLogger(Commander.name) | |
def whatIsThis() { | |
log.warning("It's a trap!") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Log class Commander { | |
def whatIsThis() { | |
log.warning("It's a trap!") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello=Hello {0}, the time currently is {1, time}! | |
Trains={0,number} trains spotted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyMessages { | |
private ResourceBundle bundle; | |
public MyMessages(Locale locale) { | |
this.bundle = ResourceBundle.getBundle("MyMessages", locale); | |
} | |
public String trains(Number arg0) { | |
String pattern = bundle.getString("Trains"); | |
MessageFormat format = new MessageFormat(pattern); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val propertyFile = cls.compilationUnit.filePath.parent.append(cls.simpleName + ".properties") | |
if (!propertyFile.exists) { | |
cls.addError('''Property file «propertyFile» does not exist''') | |
return | |
} | |
val resourceBundle = new PropertyResourceBundle(propertyFile.contentsAsStream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Iterators.forEnumeration(resourceBundle.keys).forEach [ key | | |
cls.addMethod(key.keyToMethodName) [ | |
patternVariables.forEach [ patternVariable, index | | |
addParameter("arg" + index, patternVariable.argumentType(context)) | |
] | |
returnType = string | |
body = ''' | |
«String» pattern = bundle.getString("«key»"); | |
«MessageFormat» format = new «MessageFormat»(pattern); | |
return format.format(new «Object»[]{«parameters.join(", ")[simpleName]»}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def keyToMethodName(String key) { | |
CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, key).toFirstLower | |
} | |
def argumentType(Format format, extension TypeReferenceProvider typeRefs) { | |
switch format { | |
NumberFormat: Number.newTypeReference | |
DateFormat: Date.newTypeReference | |
default: object | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Messages class MyMessages {} | |
class Test { | |
def static void main(String[] args) { | |
val messages = new MyMessages(Locale.GERMAN) | |
println(messages.hello("Stefan", new Date)) | |
print(messages.trains(3)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'travis' | |
Travis.access_token = Travis.github_auth(ENV['TRAVIS_TOKEN']) | |
repos = Travis::Repository.find_all(owner_name: 'oehme') | |
keys = ['ORG_GRADLE_PROJECT_bintrayApiKey', 'ORG_GRADLE_PROJECT_signingPassword', 'ORG_GRADLE_PROJECT_sonatypePassword'] | |
repos.each do |repo| | |
keys.each do |key| | |
puts "Setting env var '#{key}' on project '#{repo.slug}'" | |
repo.env_vars.upsert(key, "'#{ENV[key]}'", public: false) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'java' | |
id 'com.github.oehme.sobula.bintray-release' version '0.4.1' | |
} | |
group = "my.group.id" | |
description = "My really cool project" | |
contacts { | |
"me@mysite.org" { |