如果你每日只在遗留代码中挣扎,或许是时候抬起头,看看老Java中的新东西。 Guava 一句话,只要你做Java项目,就应该用Guava。 guava是Google出品的一套Java核心库,在我看来,它甚至应该是JDK的一部分。作为一个Java程序员,如果你没抱......
private Map<String, Class<?>> loadExtensionClasses() { SPI defaultAnnotation = (SPI)this.type.getAnnotation(SPI.class); if(defaultAnnotation != null) { String extensionClasses = defaultAnnotation.value(); if(extensionClasses != null && (extensionClasses = extensionClasses.trim()).length() > 0) { String[] names = NAME_SEPARATOR.split(extensionClasses); if(names.length > 1) { throw new IllegalStateException("more than 1 default extension name on extension " + this.type.getName() + ": " + Arrays.toString(names)); } if(names.length == 1) { this.cachedDefaultName = names[0]; } } } HashMap extensionClasses1 = new HashMap(); this.loadFile(extensionClasses1, "META-INF/dubbo/internal/"); this.loadFile(extensionClasses1, "META-INF/dubbo/"......
You may be curious about how a framework works? A simple framework example will be made here to demonstrate the idea of frameworks. Goal of a Framework First of all, why do we need a framework other than just a normal library? The goal of framework is defining a process which let developers implement certain functions based on individual requirements. In other words, framework defines the skeleton and developers fill in the flesh when using it. The Simplest Framework In the following example, the first 3 classes are defined as......