Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


bala
Custom Annotation
1 Answer(s)      6 years and 5 months ago
Posted in : Development process



Advertisement
View Answers

August 12, 2008 at 3:09 PM


Hi friend,

Custom Annotation





1)Annotations are metadata of a data.

2)Annotations to annotate a Java element.

3)An annotation show the declared element processed by a compiler,

4)development tool, deployment tool, or during runtime.

5)Annotations types are blueprints for annotations.



The code of a normal annotation type:



public @interface Anotaion {

int sValue();

String sOValue();

}



6).It can be processed statically before and during compile time.



7)It can be used before compile time mainly to generate supporting classes or configuration files





Categories of annotations



a)Marker annotations

e.g : @SingleAnnotationType



b)Single-value annotations

e.g : @SingleAnnotationType("datavalue")



c)Full annotations



@ShowElement(

{



@Element

(

severity=Element.CRITICAL,

item="item1", assignedTo="AT1"

),

@Element

(

severity=Element.IMPOTANT,

item="Item2", assignedTo="AT1" )



)

}

Marker: Marker type annotations have no elements



1)Example



public @interface SingleAnnotation {

}



@SingleAnnotation

public void mymethod() {

....

}



Single-Element:Annotations provide a data only.



public @interface SingleElement

{

String doWork();

}



Usage:



@SingleElement("Do work")

public void SingleMethodType() {

....

}





Full-value type annotations have multiple data members.



public @interface MultipleAnnotation {

String doWork();

int ecounter; String date();

}





@MyAnnotation (doSomething="Do work", ecount=5,

date="2008-08-08")

public void MultipleMethod() {

....

}




--------------------------------------------

Thanks & Regards

vineet





Related Tutorials/Questions & Answers:
Custom Annotation - Development process
Custom Annotation   Hi, I am Bala , I Need to Know ,How to Create Custom Annotation and I Want the Sample Program on Custom Annotation..., Custom Annotation 1)Annotations are metadata of a data. 2)Annotations
Java Custom Annotation Example
Java Custom Annotation Example In this tutorial we will learn about the annotation in Java and how it can be created. Annotations in Java contains... a simple example which will demonstrate you about how a custom annotation can
Advertisements
Annotation
custom annotations. For detailed information about annotation just visit on ... Annotation       Annotation is one more powerful feature of Java, an object-oriented programming
use of annotation.
use of annotation.  for concurrency which annotation can be used
Spring Annotation
Spring Annotation  Hi Sire please tell me that how to write Spring Annotation Based Controller ?   Spring Annotation Based Controller
Java Annotation
Java Annotation  What is annotation in Java ?   Hi please find the link of Java Annotation tutorial http://www.roseindia.net/tutorialsearch/?t=java%20annotation
annotation error
annotation error  class names "JdbcProjam.java "are only accepted if annotation processing is explicitly requested   Is your class name is JdbcProjam or JdbcProgram? Check it properly. Java is case sensitive. So use
custom exception
custom exception  Explain the process of creating custom exception and handling it.   Please visit the following link: Making custom exception
custom exception
custom exception  What is user defined exception
JAVA Annotation Error
JAVA Annotation Error  while compiling simple java program i get annotation error i.e class will only be accepted if annotation processing is explicitly requested..how to solve
Custom skin
Custom skin  Hi..... How can I make a custom skin for focusSkin property of component? please give me an example for that so i can clearly understand..... Thanks   Ans: you need to set the focusSkin using custon
custom validation
custom validation  there are fields.if we fill in first field as 1.then next field only allow to fill a,b,c,d.other letters cannot enter.if enter send error.i used this method. frmvalidator.addValidation
Junit @Test annotation
Junit @Test annotation  What is the Application of @Test Annotation in JUnit ?   The Test annotation tells JUnit that the public void method to which it is attached can be run as a test case : public class Example
@ExceptionHandler & @ResponseStatus annotation
In this section, you will learn about @ExceptionHandler & @ResponseStatus annotation
aop using annotation
aop using annotation  i got this problem in aop example using annotation example Caused by: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut jlc
aop using annotation
aop using annotation  i got this problem in aop example using annotation example Caused by: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut jlc
@RequestParam Annotation
@RequestParam Annotation This @RequestParam annotation can be used for getting the parameters from the request as, /* * The method written below takes the request parameters individually by * using @RequestParam However you can
@configuration annotation in Spring 3
@configuration annotation in Spring 3  doesn't make code tight coupling..? if we keep that in IOC in XML form, its deployment free for some kind of change management right?.   Please visit the following link: http
Many To Many annotation in ejb
Many To Many annotation in ejb   how to define primary key in the third & resulting table obtained from ManyToMany mapping.I tried the mapping but the resulting table is showing only foreign key with the two fields which
Hibernate Many To Many Annotation Mapping
Hibernate Many To Many Annotation Mapping  How to use Many To Many Annotation Mapping in Hibernate?   Hibernate requires metadata like... to another.Hibernate annotation provides annotation-based mapping. Click here
@PathVariable Annotation
@PathVariable Annotation By using the @PathVariable annotation you can create the dynamic varible at the url and can access that varible from there as. /* * Here pathVar is the new path variable when it finds the * /param
what is custom validation in struts
what is custom validation in struts  what is custom validatons in struts
Custom Website Design,Custom Web Designing,Custom Website Designing
Custom Website Design Custom Website Design Custom website designs means... Technologies Pvt Ltd is specialized company in Custom website designing. Why Custom Website Designing? The Custom Web Designing means the designing
How to configure Spring using Annotation
How to configure Spring using Annotation  Hi, How to configure Spring using Annotation Thanks
CRUD application in hibernate annotation
CRUD application in hibernate annotation      ... using hibernate annotation.  Table name: student CREATE TABLE... in hibernate annotation. Step 1:- Creating Utility Class :- The following
Hibernate id annotation
In this section, you will learn how to do mapping of id through annotation
jsf custom tooltip
jsf custom tooltip  I wants to know that is it possible to add a tooltip to the Custom JSF
Custom Cell View UITableview
Custom Cell View UITableview  How can i get two custom cell view in UITableView
HTML custom buttons
HTML custom buttons  How can I make a form with custom buttons
spring mvc3 and hibernate with annotation example
spring mvc3 and hibernate with annotation example  please send an example which is used to store the form data into database using spring with hibernate using annotations
custom uibutton programmatically
custom uibutton programmatically  Hi, How to create custom uibutton programmatically? Thanks   Hi, Please see the thread UIButton custom programmatically. Thanks
Advertisements
 

 

 

DMCA.com