Custom Annotation

Custom Annotation

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... will demonstrate you about how a custom annotation can be created. In this example we
Advertisements
Annotation
Annotation       Annotation is one more powerful feature of Java, an object-oriented programming... that is not actually part of the program. After adding annotation by Sun
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
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
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 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.....ADS_TO_REPLACE_1 Thanks   Ans: you need to set the focusSkin
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
what is custom validation in struts
what is custom validation in struts  what is custom validatons in struts
ModuleNotFoundError: No module named 'annotation'
ModuleNotFoundError: No module named 'annotation'  Hi, My Python... 'annotation' How to remove the ModuleNotFoundError: No module named 'annotation' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'annotation'
ModuleNotFoundError: No module named 'annotation'  Hi, My Python... 'annotation' How to remove the ModuleNotFoundError: No module named 'annotation' error? Thanks   Hi, In your python environment you
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 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
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
jsf custom tooltip
jsf custom tooltip  I wants to know that is it possible to add a tooltip to the Custom JSF
ModuleNotFoundError: No module named 'custom'
ModuleNotFoundError: No module named 'custom'  Hi, My Python... 'custom' How to remove the ModuleNotFoundError: No module named 'custom'... to install padas library. You can install custom python with following command
ModuleNotFoundError: No module named 'custom'
ModuleNotFoundError: No module named 'custom'  Hi, My Python... 'custom' How to remove the ModuleNotFoundError: No module named 'custom'... to install padas library. You can install custom python with following command
ModuleNotFoundError: No module named 'custom'
ModuleNotFoundError: No module named 'custom'  Hi, My Python... 'custom' How to remove the ModuleNotFoundError: No module named 'custom'... to install padas library. You can install custom python with following command
custom uibutton programmatically
custom uibutton programmatically  Hi, How to create custom uibutton programmatically? Thanks   Hi, Please see the thread UIButton custom programmatically. Thanks
@ExceptionHandler & @ResponseStatus annotation
In this section, you will learn about @ExceptionHandler & @ResponseStatus annotation
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
custom tags - JSP-Servlet
custom tags  Hai this is jagadhish. Iam learning java custom tags.Before doing these programs which jar file we have to add in the classpath..., For solving the problem visit to : http://www.roseindia.net/jsp/custom
Custom Form Validation - PHP
Custom Form Validation  Which is the best way or where should I implement the custom validation rules such as ? using number, capital letters and symbols to secure the password
JSP-Custom tags
JSP-Custom tags  First page (HTML) should display a form to enter marks for 3 subjects. On submit, the invoked jsp with custom tags should compute the average of 3 subjects
Custom Business Software Development
Custom Business Software Development  What is a Custom Business Software Development?   Custom Business Software Development Any software..., large and medium Business Softwares. And a Custom Business Software
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
custom navigation bar in iphone
custom navigation bar in iphone  How can i create a custom navigation bar in iPhone application? I wanted to add UIBarButton items as well as Search bar on the UINavigation controller ... please tell me if i need to create
Custom Validations - Struts
Custom Validations  Hi, I am trying to do the custom validations in struts 1.1.That is how can we plug in our own custom validations into Validator ? Can anybody tell me how to do this with a sample example. Thanks
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
Version of drools>drools-annotation dependency
List of Version of drools>drools-annotation dependency
Version of cn.bingoogolapple>bga-annotation dependency
List of Version of cn.bingoogolapple>bga-annotation dependency
Version of cn.bingoogolapple>loon-annotation dependency
List of Version of cn.bingoogolapple>loon-annotation dependency
Version of com.alibaba>arouter-annotation dependency
List of Version of com.alibaba>arouter-annotation dependency
Version of com.groupdocs>groupdocs-annotation dependency
List of Version of com.groupdocs>groupdocs-annotation dependency
Spring bean annotation example
Spring bean annotation example  Hi, How to configure Bean using annotation in Spring Framework? Thank   Hi, I will explain you how... annotation as given below: package net.roseindia; import
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
@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
@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
ModuleNotFoundError: No module named 'log-annotation'
ModuleNotFoundError: No module named 'log-annotation'  Hi, My... named 'log-annotation' How to remove the ModuleNotFoundError: No module named 'log-annotation' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sql-annotation'
ModuleNotFoundError: No module named 'sql-annotation'  Hi, My... named 'sql-annotation' How to remove the ModuleNotFoundError: No module named 'sql-annotation' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dtool-annotation'
ModuleNotFoundError: No module named 'dtool-annotation'  Hi, My... named 'dtool-annotation' How to remove the ModuleNotFoundError: No module named 'dtool-annotation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django_annotation'
ModuleNotFoundError: No module named 'django_annotation'  Hi, My... named 'django_annotation' How to remove the ModuleNotFoundError: No module named 'django_annotation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'annotation-refinery'
ModuleNotFoundError: No module named 'annotation-refinery'  Hi, My... named 'annotation-refinery' How to remove the ModuleNotFoundError: No module named 'annotation-refinery' error? Thanks   Hi
ModuleNotFoundError: No module named 'annotation-validation'
ModuleNotFoundError: No module named 'annotation-validation'  Hi...: No module named 'annotation-validation' How to remove the ModuleNotFoundError: No module named 'annotation-validation' error? Thanks   Hi
ModuleNotFoundError: No module named 'django_annotation'
ModuleNotFoundError: No module named 'django_annotation'  Hi, My... named 'django_annotation' How to remove the ModuleNotFoundError: No module named 'django_annotation' error? Thanks   Hi, In your

Ads