com.force.sdk.codegen.builder
Class JPAAnnotationBuilder

java.lang.Object
  extended by com.force.sdk.codegen.builder.BaseBuilder<Class<? extends Annotation>>
      extended by com.force.sdk.codegen.builder.JPAAnnotationBuilder

public class JPAAnnotationBuilder
extends BaseBuilder<Class<? extends Annotation>>

Builds JPA annotation Strings that can be included in generated source code.

JPAAnnotationBuilder takes in Annotation classes and converts those into Strings that can be added to Java source code.

Built annotations will be in the form:

@<annotationName>

Author:
Tim Kral

Field Summary
 
Fields inherited from class com.force.sdk.codegen.builder.BaseBuilder
builderString
 
Constructor Summary
JPAAnnotationBuilder(int numIndents)
          Initializes a JPAAnnotationBuilder with the number of intentions that should proceed each annotation.
 
Method Summary
 void add(Class<? extends Annotation> annotation, Map<String,String> attrs)
          Adds an annotation with attributes to this JPAAnnotationBuilder.
 
Methods inherited from class com.force.sdk.codegen.builder.BaseBuilder
add, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JPAAnnotationBuilder

public JPAAnnotationBuilder(int numIndents)
Initializes a JPAAnnotationBuilder with the number of intentions that should proceed each annotation.

Parameters:
numIndents - the number of indentations that should proceed each annotation
Method Detail

add

public void add(Class<? extends Annotation> annotation,
                Map<String,String> attrs)
Adds an annotation with attributes to this JPAAnnotationBuilder.

Note that the attributes map has String values. This method will exactly copy the attribute map values into the annotation attribute list. Therefore callers must exactly write the attribute values as they appear in String form. For example, to add the attribute name="FooBar" the caller would do the following:

map.put("name", "\"FooBar\"")

Annotations with attributes will be built in the form:

@<annotationName>(<attr1>=<attr1Value>,<attr2>=<attr2Value>,...)

Parameters:
annotation - a subclass of Annotation that represents the annotation that is to be added to this builder
attrs - a java.util.Map of attribute keys and values in String form


Copyright © 2011. All Rights Reserved.