Android ormapping Library

Source: Internet
Author: User

I use Java annotations to achieve the Android SQLite Orm Library, previously written XML, but the feeling is not very stable, efficiency, robustness of all aspects are not very good, today spent an afternoon of time, complete all the annotations, comments, generated Javadoc, wrote a sample program, and posted on GitHub, the address is: Https://github.com/Steven-Luo/AnnotationDao, interested can try to use, than the previous purely manual implementation of SQLite database operation is much simpler, scalability is also good, Use the following:

1 //entity class2@Table (name = "Dog")3  Public classDog {4     Private BooleanAlive;5     Private intID;6     PrivateString name;7 8      PublicDog () {9 Ten     } One  A      PublicDog (BooleanAlive, String name) { -          This. Alive =Alive; -          This. Name =name; the     } -  -@Id (name = "Id") -@Column (name = "id", type =Datatype.integer) +      Public intgetId () { -         returnID; +     } A  at@Column (name = "Name", type = datatype.varchar, length = 20) -      PublicString GetName () { -         returnname; -     } -  -@Column (name = "Alive", type =Datatype.boolean) in      Public BooleanisAlive () { -         returnAlive; to     } +  -      Public voidSetalive (Booleanalive) { the          This. Alive =Alive; *     } $ Panax Notoginseng      Public voidSetId (intID) { -          This. ID =ID; the     } +  A      Public voidsetName (String name) { the          This. Name =name; +     } - } $  $ //Add -Annotationdao DAO =NewAnnotationdao ( This, Dog.class); -  theString name = "Dog1"; - BooleanAlive =true;Wuyi  theDog dog =NewDog (alive, name); - Dao.insert (dog); Wu  - //Find About //List all Objects $List List =dao.list (); - //Query by ID -Dao.query (3); -  A //Delete + Dao.delete (dog); the  - //Update, you need to ensure that the ID field corresponds to the value in the database, that is, the previous call to list or query to take out the $Dog.setname ("Dog2"); theDao.update (dog);

These days to do a project, which need to draw some curves, although achartengine has been very useful, but there are a few pictures feel not quite agreeable, finally decided to draw a. In fact, mainly because of reading read the above reading time curve, I think the painting is good, so I also innovation a bit, or a cottage a bit, haha, the effect as shown:

Wait a day to write the comments, also put on GitHub up, good things, we want to share ^_^

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.