001 // Copyright 2004, 2005 The Apache Software Foundation
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package org.apache.hivemind.annotations;
016
017 import java.lang.reflect.Method;
018 import java.lang.reflect.Modifier;
019
020 import org.apache.hivemind.ClassResolver;
021 import org.apache.hivemind.impl.MessageFormatter;
022 import org.apache.hivemind.service.MethodSignature;
023
024
025 /**
026 * Used to format messages used in errors and log output for classes within the impl package.
027 *
028 * @author Achim Huegen
029 */
030 public class AnnotationsMessages
031 {
032 private static final MessageFormatter _formatter = new MessageFormatter(AnnotationsMessages.class,
033 "AnnotationsStrings");
034
035 static String unableToFindModuleClass(String moduleClassName, ClassResolver resolver)
036 {
037 return _formatter.format("unable-to-find-module-class", resolver, moduleClassName);
038 }
039
040 public static String moduleClassHasInvalidModifiers(Class moduleClass, int invalidModifiers)
041 {
042 String modifierStr = Modifier.toString(invalidModifiers);
043 return _formatter.format("module-class-has-invalid-modifiers", moduleClass.getName(), modifierStr);
044 }
045
046 public static String moduleClassIsPackagePrivate(Class moduleClass)
047 {
048 return _formatter.format("module-class-is-package-private", moduleClass.getName());
049 }
050
051 public static String annotatedMethodHasInvalidModifiers(Method method, String methodType, int invalidModifiers)
052 {
053 MethodSignature methodSig = new MethodSignature(method);
054 String modifierStr = Modifier.toString(invalidModifiers);
055 return _formatter.format("annotated-method-has-invalid-modifiers", methodSig.toString(), methodType, modifierStr);
056 }
057
058 public static String annotatedMethodIsProtectedAndNotAccessible(Method method, String methodType)
059 {
060 MethodSignature methodSig = new MethodSignature(method);
061 return _formatter.format("annotated-method-protected-not-accessible", methodSig.toString());
062 }
063
064 }