Package play.utils.meta

Examples of play.utils.meta.ModelMetadata


        ClasspathHelper.forPackage("", classloaders)).setScanners(new SubTypesScanner(),
        new TypeAnnotationsScanner()).addClassLoaders(classloaders));

    Set<Class<?>> entities = reflections.getTypesAnnotatedWith(Entity.class);
    for (Class<?> entity : entities) {
      ModelMetadata metadata = getMetadata(entity);
      map.put(entity, metadata);
    }

    return map;
  }
View Full Code Here


      }
    });
    if (log.isDebugEnabled())
      log.debug("keyField : " + keyField);
   
    ModelMetadata metadata = null;
    if (keyField.isPresent()) {
      metadata = new ModelMetadata(entity, fields, keyField.get());
    }
    return metadata;
  }
View Full Code Here

        }

        if (controller != null) {
          Class modelClass = controller.getModelClass();
          log.info("Found controller:" + controllerClass + " (" + modelClass + ")");
          ModelMetadata model = models.getModel(modelClass);
          if (model != null) {
            map.put(modelClass, new ControllerProxyREST(controller, model));
          }
        }
      } catch (Exception e) {
View Full Code Here

        }
       
        if (controller != null) {
          Class modelClass = controller.getModelClass();
          log.info("Found controller:" + controllerClass + " (" + modelClass + ")");
          ModelMetadata model = models.getModel(modelClass);
          if (model != null) {
            map.put(modelClass, new ControllerProxyCRUD(controller, model));
          }
        }
      } catch (Exception e) {
View Full Code Here

  protected F.Either<ControllerProxy, ? extends Result> controllerOrNotFound(final String name) {
    F.Option<ModelMetadata> modelInfo = getModel(name);
    if (!modelInfo.isDefined())
      return F.Either.Right(notFound("Model with name " + name + " not found!"));

    ModelMetadata model = modelInfo.get();

    ControllerProxy<?,?> crud;
    try {
      crud = getController(model);
    } catch (IncompatibleControllerException e) {
      crud = null;
    }

    if (crud == null)
      return F.Either.Right(notFound("Controller for model " + model.getType() + " not found"));

    ControllerProxy controller = crud;
    return F.Either.Left(controller);
  }
View Full Code Here

    ControllerProxy controller = crud;
    return F.Either.Left(controller);
  }

  protected F.Option<ModelMetadata> getModel(final String name) {
    ModelMetadata modelInfo = null;
    try {
      modelInfo = (ModelMetadata) Cache.getOrElse(getClass().getName() + "_ModelMetadata_" + name,
          new Callable<Object>() {

            @Override
View Full Code Here

TOP

Related Classes of play.utils.meta.ModelMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.