/**
  * Handle notification of the creation of a new classloader.
  *
  * @param logger the logging channel
  * @param label the classloader label
  * @param category the classloader category
  * @param classloader the new classloader to report
  */
 private static void classloaderConstructed(
     Logger logger, String label, Category category, ClassLoader classloader) {
   if (logger.isTraceEnabled()) {
     int id = System.identityHashCode(classloader);
     StringBuffer buffer = new StringBuffer();
     buffer.append("new ");
     buffer.append(category.toString());
     buffer.append(" classloader for " + label);
     buffer.append("\n           id: " + id);
     ClassLoader parent = classloader.getParent();
     if (null != parent) {
       int pid = System.identityHashCode(parent);
       buffer.append("\n      extends: " + pid);
     }
     if (classloader instanceof URLClassLoader) {
       URLClassLoader loader = (URLClassLoader) classloader;
       URL[] urls = loader.getURLs();
       if (urls.length == 1) {
         buffer.append("\n     contains: 1 entry");
       } else {
         buffer.append("\n     contains: " + urls.length + " entries");
       }
       for (int i = 0; i < urls.length; i++) {
         URL url = urls[i];
         buffer.append("\n         [" + (i + 1) + "] " + url.toString());
       }
     }
     logger.trace(buffer.toString());
   }
 }
Exemplo n.º 2
0
 private static List<Product> getProductListByCategory(
     List<Product> productList, Category category) {
   List<Product> products = new ArrayList<>();
   for (Product product : productList) {
     if (product.getCategory().toString().equals(category.toString())) {
       products.add(product);
     }
   }
   return products;
 }
Exemplo n.º 3
0
  private void displayCategory(Category c, Player p) {
    p.sendMessage("----Available Commands and Sub-Categories----");
    p.sendMessage("-----------------------------------------");
    for (Command com : c.listCommands()) {
      p.sendMessage(com.toString());
    }

    for (Category subCat : c.listCategories()) {
      p.sendMessage(subCat.toString());
    }
  }
Exemplo n.º 4
0
 @RequestMapping(value = "/type_map", method = RequestMethod.GET)
 public @ResponseBody JSONArray getTypeMap() {
   JSONArray jsonArray = new JSONArray();
   Map<Type, List<Category>> typeMap = productService.getTypeMap();
   for (Type key : typeMap.keySet()) {
     List<Category> categoryList = typeMap.get(key);
     JSONArray categoryJsonArray = new JSONArray();
     for (Category category : categoryList) {
       JSONObject jsonObject = new JSONObject();
       jsonObject.put("key", category.getCategory());
       jsonObject.put("value", category.toString());
       categoryJsonArray.add(jsonObject);
     }
     JSONObject jsonObject = new JSONObject();
     jsonObject.put("name", key.getType());
     jsonObject.put("value", key.toString());
     jsonObject.put("list", categoryJsonArray);
     jsonArray.add(jsonObject);
   }
   return jsonArray;
 }
Exemplo n.º 5
0
 public String toString() {
   return "\"" + object + "\" --> " + category.toString();
 }