Пример #1
0
  public synchronized Class getClass(String type) {
    if (!initialized) {
      initialize();
    }

    Class clazz = (Class) this.classes.get(type);
    if (clazz == null) {
      clazz = ClassUtil.forName(type);
      this.classes.put(type, clazz);
    }
    return clazz;
  }
 public S2Container build(String path) {
   try {
     S2Container container = new S2ContainerImpl();
     Properties props = new Properties();
     props.load(ResourceUtil.getResourceAsStream(path));
     for (Iterator it = props.keySet().iterator(); it.hasNext(); ) {
       String name = (String) it.next();
       container.register(ClassUtil.forName(props.getProperty(name)), name);
     }
     return container;
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
Пример #3
0
 /**
  * バージョンチェック用かどうかを処理します。
  *
  * @param propertyMeta プロパティメタデータ
  * @param field フィールド
  * @param entityMeta エンティティメタデータ
  */
 protected void doVersion(
     PropertyMeta propertyMeta, Field field, @SuppressWarnings("unused") EntityMeta entityMeta) {
   if (field.getAnnotation(Version.class) == null) {
     return;
   }
   Class<?> clazz = ClassUtil.getWrapperClassIfPrimitive(field.getType());
   if (clazz != Integer.class
       && clazz != Long.class
       && clazz != int.class
       && clazz != long.class) {
     throw new VersionPropertyNotNumberRuntimeException(
         entityMeta.getName(), propertyMeta.getName());
   }
   propertyMeta.setVersion(true);
 }