background preloader

Project Lombok

Project Lombok

Think again before adopting the commons-logging API by Ceki Gülcü, November 14th, 2002, last updated October 29th, 2009, © All rights reserved Introduction Given that log4j is such a low-level library, most organizations are hesitant to tie their code to log4j, especially considering the new logging API included in JDK 1.4. Before going forward, it is appropriate to mention that these two APIs are very similar. The classical usage pattern for log4j is: import org.apache.log4j.Logger; public class MyClass { final static Logger logger = Logger.getLogger("some.name"); public void foo1() { logger.debug("Hello world."); } public void foo2() { logger.info("Another message."); logger.error("Stop that!" As you are well aware by now, one of the important benefits of log4j is that it can be configured at run time using configuration scripts. Although the log4j API is at least two years older than JDK 1.4, notice the extent to which the two APIs are similar. Although not particularly difficult, it turns out that wrappers are not trivial to write.

jsdt - Debug javascript in ie,firefox,chrome,safari,opera and all browsers support ajax Javascript Debug Toolkit is a software can debug javascript in ie,firefox,safari,chrome,opera,mobile ie browser,mobile opera browser and so on .It works in all the browser support ajax. Javascript Debug Toolkit 2.2.0 is published! update site URL: Browser support of debug tools There are tow version of jsdt. Javascript Debug Toolkit s0.5 is a Green-free installation software. *document* Green version of jsdt,need JRE1.5 *download* Install version in windows. Javascript Debug Toolkit 2.2.0 version is a eclipse plugin to debug javascript crossbrowser. *document* *download* Javascript Debug Toolkit 可以在ie,firefox,safari,chrome,opera, 移动IE浏览器,移动opera浏览器等任何支持ajax的浏览器中调试javascript. jsdt有两个版本 独立版是绿色跨平台跨浏览器的软件,可以在windows和linux上运行 文档 解压版需要安装jre1.5 解压版 安装版在windows下安装即可运行 *安装版*

Stereotype Annotations Cut Down XML Configuration in Spring nnotations have been part of the Spring Model-View-Controller (MVC) Framework since Spring 2.0. In Spring, annotations can greatly reduce the amount of XML bean configuration and wiring needed. Given the many components of the Spring MVC environment (handler mapping, controller, view resolver, and view), XML configuration can turn unwieldy in a hurry. So, Spring MVC configuration is certainly one area that can really benefit from reduced configuration. As of Spring 2.5, the framework added new annotations to more easily configure and assemble the components of a multi-layered application, such as you might find in an MVC-designed system. In fact, an important type of annotation added in Spring 2.5, stereotype annotations, is for configuring the Spring MVC controller components. Are these new annotations critical to your applications? In Spring framework 3.0 there will be a number of deprecations, for example, the old MVC controller hierarchy. Stereotype Annotations

JDBI : Convenient SQL for Java ProxyFactory (Javassist API) Factory of dynamic proxy classes. This factory generates a class that extends the given super class and implements the given interfaces. The calls of the methods inherited from the super class are forwarded and then invoke() is called on the method handler associated with instances of the generated class. The calls of the methods from the interfaces are also forwarded to the method handler. For example, if the following code is executed, Here, Method is java.lang.reflect.Method. Then, the following method call will be forwarded to MethodHandler mi and prints a message before executing the originally called method bar() in Foo. foo.bar(); The last three lines of the code shown above can be replaced with a call to the helper method create, which generates a proxy class, instantiates it, and sets the method handler of the instance: : Foo foo = (Foo)f.create(new Class[0], new Object[0], mi); To change the method handler during runtime, execute the following code:

On TermKit I've been administering Unix machines for many years now, and frankly, it kinda sucks. It makes me wonder, when sitting in front of a crisp, 2.3 million pixel display (i.e. a laptop) why I'm telling those pixels to draw me a computer terminal from the 80s. And yet, that's what us tech nerds do every day. The default Unix toolchain, marked in time by the 1970 epoch, operates in a world where data is either binary or text, and text is displayed in monospace chunks. The Unix philosophy talks about software as a toolset, about tiny programs that can be composed seamlessly. In the meantime, we've gotten a lot better at displaying information. And yet the world of Unix is rife with jargon, invisible processes, traps and legacy bits. So while I agree that having a flexible toolbox is great, in my opinion, those pieces could be built a lot better. I see TermKit as an extension of what Apple did with OS X, in particular the system tools like Disk Utility and Activity Monitor. Rich Display Pipes

Annotation based Caching in Java I probably had to write cache to store results of expensive operations or queries a dozens of times over last ten years of Java. And this week, I had to redo again. Though, there are a lot of libraries such as JCS , Terracota or Tangosol, but I just decided to write a simple implementation myself. First I defined an annotation that will be used to mark any class or methods cachable: 1 import java.lang.reflect.*; 2 import java.lang.annotation.*; 3 4 5 6 7 8 9 @Target({ElementType.TYPE, ElementType.METHOD}) 10 @Retention(RetentionPolicy.RUNTIME) 11 public @interface Cacheable { 12 13 14 15 boolean cache() default true; 1617 18 19 20 21 22 int maxCapacity() default 1000; 2324 25 26 27 28 boolean synchronizeAccess() default false; 2930 int timeoutInSecs() default 300; 3132 33 34 35 public boolean canReloadAsynchronously() default false; 36 } 3738 I then defined a map class to store cache: A couple of interfaces to load or search key/values: A utility class for storing pair of objects:

spullara/mustache.java State of the Collections April 2012 This is an informal overview of the major proposed library enhancements to take advantage of new language features, primarily lambda expressions and extension methods, specified by JSR 335 and implemented in the OpenJDK Lambda Project. This document describes the design approach taken in the rough prototype that has been implemented in the Lambda Project repository. It is intended as a working straw-man proposal; the final version may look different, but there is a working design and implementation that may now serve as a jumping-off point for discussions. Background Had lambda expressions (closures) been part of the Java language from the beginning, our Collections APIs would certainly look different than they do today. Parallelism is an important driver for this work. For a description of the language features being specified by JSR 335, see the State of the Lambda. Internal vs external iteration for (Block b : blocks) { b.setColor(RED); } The role of laziness Streams No storage.

untitled Annotation-Based Transactions in Spring - Wheeler Software I n this article, I'm going to show you how to use transaction management annotations in Spring. I'm using Spring 2.5 though these features have been available at least since Spring 2.0. Spring provides several different approaches to transaction management: Programmatic: You can write your transactions using Java source code directly. Declarative: You can declare transaction definitions in either a centralized way using XML or in a distributed way using annotations: XML-based: You can configure transactions in Spring's centralized application context file. Proxy-based: In this approach you wrap your service beans with transactional proxies. AOP-based: Here you define AOP aspects to endow your service beans with transactional semantics. Annotation-based: You can use Java 5 annotations to distribute transaction configuration across Java classes. As the title suggests, this article deals with annotation-based configuration.

ryantenney/metrics-spring Modularization in java 8

Related: