Java Development-The waves

Source: Internet
Author: User
Tags net time

A lot of new Java projects need to be online recently, but a lot of Java related libraries are not very familiar with, the project met with a great deal of resistance, survived for several days of the night. Now the work is basically completed, so I intend to summarize the relevant Java tools library, in the future need to help you, good in Java under the ocean, the waves . (Want to be like a pony in a movie programmer J)

The waves will sometimes, straight hanging Yun fan cang hai-li Bai

First, through a mind map, familiar with the common Java Basic Toolkit, Master good tool is a good engineer's basic requirements Oh! J

The figure of the Red Star indicated must be proficient in the content, yellow star for the need to master the content, the other to supplement the content, this article mainly introduces the basic library, framework library and log library content.

    • Apache Commons Lang

While it is now recommended to use guava instead of Commons, it is also great to use both of these popular base libraries, and the following table is used to familiarize yourself with the most common uses.

Function

Example

stringutils.isempty (null), Stringutils.isblank (" ")

stringutils.trim ("abc"), Stringutils.strip ("  abc",  "XYZ")

string[] r01 = stringutils.split ("  ABC dd")

string[] r02 = stringutils.split ("Abc,dd", ",")

stringutils.splitpreservealltokens (str4,  ",")

array elements splicing   

stringutils.join (array,  ",")

random number

randomstringutils.randomascii ()

array operation

arrayutils.clone (arr)

arrayutils.toobject (ARRAY10)

Date

Dateutils.parsedate ("2010/01/01 11:22:33", New string[]{"Yyyy-mm-dd HH:mm:ss"})

Basic Reflection Tools

Beanutils.getproperty (Bean, "name")

Samplebean Newbean = (samplebean) Beanutils.clonebean (bean);

Beanutils.describe (Bean); Get annotations

Beanutils.populate (bean, map);//Fill data

string[] Array = beanutils.getarrayproperty (bean, "array");//Get array

String value = Beanutils.getnestedproperty (Bean, "nestedbean.nestedproperty")

Beanutils.setproperty (bean8, "url", "http://www.google.com/");

DateConverter converter = new DateConverter ();

Converter.setpattern ("Yyyy/mm/dd HH:mm:ss");

Convertutils.register (converter, date.class);

Convertutils.register (converter, string.class);

Beanutils.setproperty (Bean9, "date", "2010/12/19 23:40:00");

implement Equals, etc.

public boolean equals (object obj)  { 

 return equalsbuilder.reflectionequals (this, obj);   }

invokemethod

main main = new main ();

child child = new child (); 

Methodutils.invokemethod (main,  "Pass",  child) ;  // OK 

methodutils.invokeexactmethod (child,  " Pass ',  child);  

Lang.time.*

Fastdateformat is thread-safe relative to SimpleDateFormat

TIP:

With regard to thread safety, the usual methods are: Add new each time, add synchronize, use thread-local, reduce the number of new times when the thread is reused, and use Object-pool to share multiple objects.

    • Guava

functions

example

Replication Common Object method

objects.equal (null, NULL)

objects.tostringhelper (Person.class)

comparisonchain.start (). Compare (name, other.name). result ();

throwables

throwable getrootcause (throwable)

list<throwable> Getcausalchain (throwable)

  immutablelist<string> imlist=  immutablelist . copyOf (list);   

Other

Strings. Range, Eventbus, Caches, management of NULL values (a pain point in Java)

Guava official course of Chinese translation: http://ifeve.com/google-guava/

    • Joda-time

This part is added later, in. NET time date use is very simple and convenient, but Java is actually a pain point!!! Some basic time-date operations are often relatively complex by date,timestamp,calendar and other types. So to speak, mastered the guava,joda-time, preferably also have jdk8 (production temporarily not popular), basically code efficiency can basically return to write C # level. One of the most basic examples is getting the date part of the first day of the month for a date : DateTime curMonth1 = DateTime.Now (). DayOfMonth (). Withminimumvalue (). Withtimeatstartofday ();

Official documents: http://www.joda.org/joda-time/userguide.html

    • Spring Series (Learn more about Spring Series)

It is a lightweight Java development framework project that emerged in the 2003 and has evolved over the years to become a (in fact) standardized component of Java projects, including many sub-projects and related projects, which can be said to be very good, greatly simplifying programmer work, and being stable and efficient. (In simple terms, it's a great fit for the current internet scene, without the need for a chatty super-app, but rather a continuous iteration of fast-on-the-go projects that provide effective service through SOA.) For individuals, now the project, except H5 and other front-end content, the core is 3 axes , the Web to provide user access, SOA services to provide core services, job completion of all kinds of dirty live dirty, the other main play an auxiliary role)

Core function: Spring-core, the core is to complete the creation of beans (DI) and management, more than our own management of more reasonable, and beautiful coding, clear thinking.

Auxiliary functions: SPRING-AOP aspect function, TX transaction function, RMI remote service function, jmstemplate message function, JDBC database connection and other functions (integration MyBatis).

Web support: SPRINGMVC, market share first, not explained.

The last two years are extremely hot: Spring boot, rapid applicaition development for the purpose of simplifying project development, but there is no essential difference behind the Java development of the past.

    • Front-end Frame selection:

Angular+bootstrap+jquery, background Java, the basic application of most small and medium-sized projects. For large-scale projects, you can see the Bo Lord leaves-Chai great god of the hybrid technology series of articles.

    • Log

Java attaches great importance to the separation of interface and implementation, the use of interface definition standards, if the. NET (only the implementation of the Microsoft, once brilliant, also caused the current business shrinkage) This is optional, Java is the necessary option. For example, spring AOP only supports the use of the interface, and slf4j is a log interface standard , whether it is log4j2,logback, provided by its implementation, the development of transparent, very convenient plug-in management.

For all demo content, please see: Javademo project in GitHub.

Finally, recommend a question and a great blog post (Chinese translation)

what are the Popular front-end frameworks now? (after the completion of Java learning, start a comprehensive front-end learning, basically reach the level of an Internet engineer to consider the next plan)

2017 programming languages, frameworks and tools you should learn

Java Development-The waves

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.