All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jomc.tools.templates.jomc-java-bundles.implementation-messages.vm Maven / Gradle / Ivy

The newest version!
##
##   Copyright (C) Christian Schulte , 2005-206
##   All rights reserved.
##
##   Redistribution and use in source and binary forms, with or without
##   modification, are permitted provided that the following conditions
##   are met:
##
##     o Redistributions of source code must retain the above copyright
##       notice, this list of conditions and the following disclaimer.
##
##     o Redistributions in binary form must reproduce the above copyright
##       notice, this list of conditions and the following disclaimer in
##       the documentation and/or other materials provided with the
##       distribution.
##
##   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
##   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
##   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
##   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
##   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
##   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
##   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
##   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
##   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
##   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
##
##   $JOMC: implementation-messages.vm 5043 2015-05-27 07:03:39Z schulte $
##
## @param model The model declaring the modules of the implementation to render.
## @param modules The modules declaring the implementation to render.
## @param imodel The inheritance model of the modules declaring the implementation to render.
## @param smodel The source file model to render.
## @param ssection The source section model to render.
## @param implementation The implementation to render.
## @param tool The tool merging the template.
## @param toolName The name of the tool merging the template.
## @param toolVersion The version of the tool merging the template.
## @param toolUrl The URL to the site of the tool merging the template.
## @param calendar A java.util.Calendar instance.
## @param now The current timestamp formatted using the pattern "yyyy-MM-dd'T'HH:mm:ss.SSSZ".
## @param year The current year formatted using the pattern "yyyy".
## @param month The current month formatted using the pattern "MM".
## @param day The current day formatted using the pattern "dd".
## @param hour The current hour formatted using the pattern "HH".
## @param minute The current minute formatted using the pattern "mm".
## @param second The current second formatted using the pattern "ss".
## @param timezone The current timezone formatted using the pattern "Z".
## @param shortDate The current date formatted using a 'SHORT' format style.
## @param mediumDate The current date formatted using a 'MEDIUM' format style.
## @param longDate The current date formatted using a 'LONG' format style.
## @param isoDate The current date formatted using an ISO-8601 format style.
## @param shortTime The current time formatted using a 'SHORT' format style.
## @param mediumTime The current time formatted using a 'MEDIUM' format style.
## @param longTime The current time formatted using a 'LONG' format style.
## @param isoTime The current time formatted using an ISO-8601 format style.
## @param shortDateTime The current date and time formatted using a 'SHORT' format style.
## @param mediumDateTime The current date and time formatted using a 'MEDIUM' format style.
## @param longDateTime The current date and time formatted using a 'LONG' format style.
## @param isoDateTime The current date and time formatted using an ISO-8601 format style.
#set($messages = $modules.getMessages($implementation.getIdentifier()))
#if($messages)
#if($with-editor-fold)
${tool.getIndentation(1)}${smodel.getHeadComment()} #if(${smodel.getTailComment()} && ${smodel.getTailComment().length()} > 0) ${smodel.getTailComment()}#end

#end
#foreach($message in $messages.getMessage())
#if($with-javadoc)
${tool.getIndentation(1)}/**
${tool.getIndentation(1)} * Gets the text of the {@code <$message.getName()>} message.
${tool.getIndentation(1)} * 

${tool.getIndentation(1)} *
Languages:
#foreach($text in $message.getTemplate().getText()) ${tool.getIndentation(1)} *
$tool.getHtmlString($tool.getDisplayLanguage($text.getLanguage()))#if($message.getTemplate().getDefaultLanguage() == $text.getLanguage()) (default)#end
#end ${tool.getIndentation(1)} *
Final:
$tool.getBooleanString($message.isFinal())
${tool.getIndentation(1)} *

${tool.getIndentation(1)} * @param locale The locale of the message to return. #if($message.getArguments() && !$message.getArguments().getArgument().isEmpty()) #set($i = 0) #foreach($argument in $message.getArguments().getArgument()) #set($argument = $message.getArguments().getArgument($i)) #set($i = $i + 1) ${tool.getIndentation(1)} * @param $argument.getJavaVariableName() #if($argument.getDocumentation())$argument.getDocumentation().getText($tool.getLocale()).getJavadocComment($tool.getLineSeparator(), $tool.getIndentntation(1))#end#if(!$argument.getDocumentation())Format argument.#end #end #end #if($message.getDocumentation()) ${tool.getIndentation(1)} * @return $message.getDocumentation().getText($tool.getLocale()).getJavadocComment($tool.getLineSeparator(), $tool.getIndentation(1)) #else ${tool.getIndentation(1)} * @return The text of the {@code <$message.getName()>} message for {@code locale}. #end ${tool.getIndentation(1)} * @throws org.jomc.ObjectManagementException if getting the message instance fails. ${tool.getIndentation(1)} */ #end #if($message.isDeprecated()) ${tool.getIndentation(1)}@Deprecated #end #if($with-suppress-warnings) ${tool.getIndentation(1)}@SuppressWarnings($with-suppress-warnings) #end #if($with-jsr-250) ${tool.getIndentation(1)}@javax.annotation.Generated( value = "$toolName $toolVersion", comments = "See $toolUrl" ) #end ${tool.getIndentation(1)}$modules.getMessageJavaModifierName($implementation.getIdentifier(), $message.getName()) static String $message.getJavaGetterMethodName()( final java.util.Locale locale#if($message.getArguments() && !$message.getArguments().getArgument().isEmpty())#set($i = 0)#foreach($argument in $message.getArguments().getArgument())#set($argument = $message.getArguments().getArgument($i))#set($i = $i + 1), final $argument.getJavaTypeName().getName(true) $argument.getJavaVariableName()#end#end ) ${tool.getIndentation(1)}{ ${tool.getIndentation(2)}java.io.BufferedReader reader = null; ${tool.getIndentation(2)}boolean suppressExceptionOnClose = true; ${tool.getIndentation(2)}try ${tool.getIndentation(2)}{ ${tool.getIndentation(3)}final String message = java.text.MessageFormat.format( java.util.ResourceBundle.getBundle( "${implementation.getJavaTypeName().getQualifiedName()}", locale ).getString( "${tool.getJavaString($message.getName())}" )#if($message.getArguments() && !$message.getArguments().getArgument().isEmpty())#set($i = 0)#foreach($argument in $message.getArguments().getArgument())#set($argument = $message.getArguments().getArgument($i))#set($i = $i + 1), $argument.getJavaVariableName()#end#end, (Object) null ); ${tool.getIndentation(3)}final java.lang.StringBuilder builder = new java.lang.StringBuilder( message.length() ); ${tool.getIndentation(3)}reader = new java.io.BufferedReader( new java.io.StringReader( message ) ); ${tool.getIndentation(3)}final String lineSeparator = System.getProperty( "line.separator", "\n" ); ${tool.getIndentation(3)}String line; ${tool.getIndentation(3)}while ( ( line = reader.readLine() ) != null ) ${tool.getIndentation(3)}{ ${tool.getIndentation(4)}builder.append( lineSeparator ).append( line ); ${tool.getIndentation(3)}} ${tool.getIndentation(3)}suppressExceptionOnClose = false; ${tool.getIndentation(3)}return builder.length() > 0 ? builder.substring( lineSeparator.length() ) : ""; ${tool.getIndentation(2)}} ${tool.getIndentation(2)}catch( final java.lang.ClassCastException e ) ${tool.getIndentation(2)}{ ${tool.getIndentation(3)}throw new org.jomc.ObjectManagementException( e.getMessage(), e ); ${tool.getIndentation(2)}} ${tool.getIndentation(2)}catch( final java.lang.IllegalArgumentException e ) ${tool.getIndentation(2)}{ ${tool.getIndentation(3)}throw new org.jomc.ObjectManagementException( e.getMessage(), e ); ${tool.getIndentation(2)}} ${tool.getIndentation(2)}catch( final java.util.MissingResourceException e ) ${tool.getIndentation(2)}{ ${tool.getIndentation(3)}throw new org.jomc.ObjectManagementException( e.getMessage(), e ); ${tool.getIndentation(2)}} ${tool.getIndentation(2)}catch( final java.io.IOException e ) ${tool.getIndentation(2)}{ ${tool.getIndentation(3)}throw new org.jomc.ObjectManagementException( e.getMessage(), e ); ${tool.getIndentation(2)}} ${tool.getIndentation(2)}finally ${tool.getIndentation(2)}{ ${tool.getIndentation(3)}try ${tool.getIndentation(3)}{ ${tool.getIndentation(4)}if( reader != null ) ${tool.getIndentation(4)}{ ${tool.getIndentation(5)}reader.close(); ${tool.getIndentation(4)}} ${tool.getIndentation(3)}} ${tool.getIndentation(3)}catch( final java.io.IOException e ) ${tool.getIndentation(3)}{ ${tool.getIndentation(4)}if( !suppressExceptionOnClose ) ${tool.getIndentation(4)}{ ${tool.getIndentation(5)}throw new org.jomc.ObjectManagementException( e.getMessage(), e ); ${tool.getIndentation(4)}} ${tool.getIndentation(3)}} ${tool.getIndentation(2)}} ${tool.getIndentation(1)}} #end #if($with-editor-fold) ${tool.getIndentation(1)}${smodel.getHeadComment()}
#if(${smodel.getTailComment()} && ${smodel.getTailComment().length()} > 0) ${smodel.getTailComment()}#end #end #end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy