public class FieldOperations extends Object
Constructor and Description |
---|
FieldOperations() |
Modifier and Type | Method and Description |
---|---|
org.jboss.forge.roaster.model.source.FieldSource<org.jboss.forge.roaster.model.source.JavaClassSource> |
addFieldTo(org.jboss.forge.roaster.model.source.JavaClassSource targetClass,
String fieldType,
String fieldName,
String... annotations)
Adds the field with private visibility, including getter and setter, updating the toString()
|
org.jboss.forge.roaster.model.source.FieldSource<org.jboss.forge.roaster.model.source.JavaClassSource> |
addFieldTo(org.jboss.forge.roaster.model.source.JavaClassSource targetClass,
String fieldType,
String fieldName,
org.jboss.forge.roaster.model.Visibility visibility,
boolean withGetter,
boolean withSetter,
String... annotations)
Adds the field, updating the toString().
|
protected boolean |
canAddFieldToToString(org.jboss.forge.roaster.model.Field<org.jboss.forge.roaster.model.source.JavaClassSource> field) |
boolean |
isFieldTypeEnum(Project project,
org.jboss.forge.roaster.model.source.JavaClassSource targetEntity,
String fieldType) |
boolean |
isFieldTypeEnum(Project project,
String fieldType) |
void |
removeField(org.jboss.forge.roaster.model.source.JavaClassSource targetClass,
org.jboss.forge.roaster.model.Field<org.jboss.forge.roaster.model.source.JavaClassSource> field)
Removes the field, including its getters and setters and updating toString()
|
public void removeField(org.jboss.forge.roaster.model.source.JavaClassSource targetClass, org.jboss.forge.roaster.model.Field<org.jboss.forge.roaster.model.source.JavaClassSource> field)
targetClass
- The class, which field will be removedfield
- The field to be removedpublic org.jboss.forge.roaster.model.source.FieldSource<org.jboss.forge.roaster.model.source.JavaClassSource> addFieldTo(org.jboss.forge.roaster.model.source.JavaClassSource targetClass, String fieldType, String fieldName, String... annotations)
targetClass
- The class which the field will be added tofieldType
- The type of the fieldfieldName
- The name of the fieldannotations
- An optional list of annotations that will be added to the fieldpublic org.jboss.forge.roaster.model.source.FieldSource<org.jboss.forge.roaster.model.source.JavaClassSource> addFieldTo(org.jboss.forge.roaster.model.source.JavaClassSource targetClass, String fieldType, String fieldName, org.jboss.forge.roaster.model.Visibility visibility, boolean withGetter, boolean withSetter, String... annotations)
targetClass
- The class which the field will be added tofieldType
- The type of the fieldfieldName
- The name of the fieldvisibility
- The visibility of the newly created fieldwithGetter
- Specifies whether accessor method should be createdwithSetter
- Specifies whether mutator method should be createdannotations
- An optional list of annotations that will be added to the fieldprotected boolean canAddFieldToToString(org.jboss.forge.roaster.model.Field<org.jboss.forge.roaster.model.source.JavaClassSource> field)
public boolean isFieldTypeEnum(Project project, String fieldType)
project
- Project in which the fieldType will be searchedfieldType
- Full type of the field with packageIllegalArgumentException
- if fieldType or project is nullpublic boolean isFieldTypeEnum(Project project, org.jboss.forge.roaster.model.source.JavaClassSource targetEntity, String fieldType)
project
- Project in which the fieldType will be searchedfieldType
- Type of the fieldtargetEntity
- Entity which package which will be used if fieldType doesn't have package specifiedIllegalArgumentException
- if fieldType or project is nullCopyright © 2014 JBoss by Red Hat. All rights reserved.