View Javadoc

1   // Copyright 2006 Daniel Gredler
2   //
3   // Licensed under the Apache License, Version 2.0 (the "License");
4   // you may not use this file except in compliance with the License.
5   // You may obtain a copy of the License at
6   //
7   //     http://www.apache.org/licenses/LICENSE-2.0
8   //
9   // Unless required by applicable law or agreed to in writing, software
10  // distributed under the License is distributed on an "AS IS" BASIS,
11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  // See the License for the specific language governing permissions and
13  // limitations under the License.
14  
15  package net.sf.beanform.prop;
16  
17  import java.util.List;
18  
19  import org.apache.hivemind.impl.MessageFormatter;
20  
21  /***
22   * Messages for the {@link BeanProperty} and {@link BeanPropertySqueezer} classes.
23   *
24   * @author Daniel Gredler
25   */
26  class BeanPropertyMessages {
27  
28      private final static MessageFormatter FORMATTER = new MessageFormatter( BeanPropertyMessages.class, "BeanPropertyMessages" );
29  
30      static String unrecognizedInputType( BeanProperty property, List<String> validInputTypes ) {
31          return FORMATTER.format( "unrecognized-input-type", property.getInput(), property.getName(), validInputTypes );
32      }
33  
34      static String setBeanNullBean() {
35          return FORMATTER.getMessage( "set-bean-null-bean" );
36      }
37  
38      static String getValueNullBean() {
39          return FORMATTER.getMessage( "get-value-null-bean" );
40      }
41  
42      static String setValueNullBean() {
43          return FORMATTER.getMessage( "set-value-null-bean" );
44      }
45  
46      static String getValueNotReadable( BeanProperty property ) {
47          return FORMATTER.format( "get-value-not-readable", property.getName() );
48      }
49  
50      static String setValueNotWriteable( BeanProperty property ) {
51          return FORMATTER.format( "set-value-not-writeable", property.getName() );
52      }
53  
54      static String setValueIllegalArgument( Object value ) {
55          if( value != null ) return FORMATTER.format( "set-value-illegal-arg-1", value.getClass().getName(), value );
56          else return FORMATTER.format( "set-value-illegal-arg-2", value );
57      }
58  
59      static String unsqueezeClassNotFound( String squeezed, String className ) {
60          return FORMATTER.format( "unsqueeze-class-not-found", squeezed, className );
61      }
62  
63  }