public class GeneratorUtils extends Object
Constructor and Description |
---|
GeneratorUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
debugLoggingEnabled() |
static AnnotationValue |
extractAnnotationPropertyValue(Elements elementUtils,
AnnotationMirror annotation,
CharSequence annotationProperty) |
static List<AnnotationMirror> |
extractAnnotationsFromAnnotation(Elements elementUtils,
Element element,
String annotationName,
String paramName)
Pulls nested annotations out of the annotation that contains them.
|
static String |
extractAnnotationStringValue(Elements elementUtils,
AnnotationMirror annotation,
CharSequence paramName) |
static Collection<String> |
extractValue(AnnotationValue value)
Provides a uniform way of working with single- and multi-valued AnnotationValue objects.
|
static String |
formatAssociatedResources(Collection<String> resourceTypes) |
static List<String> |
getAllQualifiersDeclarationFromType(TypeElement element)
This method builds a list of all qualifier annotations source-code declaration that annotates the passed element.
|
static AnnotationMirror |
getAnnotation(Elements elementUtils,
Element annotationTarget,
String annotationName) |
static String |
getBeanActivatorClassName(TypeElement classElement,
ProcessingEnvironment processingEnvironment) |
static String |
getBodyHeightMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment) |
static String |
getContextIdMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment) |
static String |
getDefaultPositionMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@DefaultPosition . |
static String |
getInterceptMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment) |
static String |
getIsDirtyMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@IsDirty . |
static boolean |
getIsElement(TypeMirror type,
ProcessingEnvironment processingEnvironment)
Check whether the provided type extends IsElement.
|
static boolean |
getIsPopup(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Check whether the provided type extends PopupPanel.
|
static boolean |
getIsWidget(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Check whether the provided type extends IsWidget.
|
static String |
getMenuBarMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@WorkbenchMenu . |
static String |
getOnCloseMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@OnClose . |
static String |
getOnContextAttachPanelDefinitionMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment) |
static String |
getOnFocusMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@OnFocus . |
static String |
getOnLostFocusMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@OnLostFocus . |
static String |
getOnMayCloseMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@OnMayClose . |
static String |
getOnOpenMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@OnOpen . |
static String |
getOnSaveMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@OnSave . |
static String |
getOnShutdownMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@OnShutdown . |
static ExecutableElement |
getOnStartupMethodForEditors(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Finds the
@OnStartup method suitable for @WorkbenchEditor classes. |
static ExecutableElement |
getOnStartupMethodForNonEditors(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Finds the
@OnStartup method suitable for workbench classes that are not @WorkbenchEditor . |
static String |
getOwningPerspectivePlaceRequest(TypeElement screenOrEditorClass,
ProcessingEnvironment processingEnvironment)
Returns the identifier (PlaceRequest ID) of the perspective that owns the given part.
|
static String |
getPerspectiveMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@Perspective . |
static String |
getPopupMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@WorkbenchPartView . |
static Name |
getQualifiedName(AnnotationMirror annotation) |
static String |
getSplashFilterMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment) |
static String |
getTitleMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@WorkbenchPartTitle . |
static ExecutableElement |
getTitleWidgetMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@WorkbenchPartTitleDecoration . |
static String |
getToolBarMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@WorkbenchToolBar . |
static ExecutableElement |
getWidgetMethodName(TypeElement classElement,
ProcessingEnvironment processingEnvironment)
Get the method name annotated with
@WorkbenchPartView . |
static boolean |
hasPresenterInitMethod(TypeElement classElement,
ProcessingEnvironment processingEnvironment,
ExecutableElement getWidgetMethod) |
public static ExecutableElement getOnStartupMethodForNonEditors(TypeElement classElement, ProcessingEnvironment processingEnvironment)
@OnStartup
method suitable for workbench classes that are not @WorkbenchEditor
.
The method must be public, non-static, have a return-type of void and either take zero parameters or one
parameter of type PlaceRequest
.
If no such method is found, returns null. If methods annotated with @OnStartup
are found but they do not
satisfy all the requirements, they are marked with errors explaining the problem.public static ExecutableElement getOnStartupMethodForEditors(TypeElement classElement, ProcessingEnvironment processingEnvironment)
@OnStartup
method suitable for @WorkbenchEditor
classes.
The method must be public, non-static, have a return-type of void and either take one parameter
of type Path
or two parameters of type (Path, PlaceRequest)
.
If no such method is found, returns null. If methods annotated with @OnStartup
are found but they do not
satisfy all the requirements, they are marked with errors explaining the problem.public static String getOnContextAttachPanelDefinitionMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
GenerationException
public static String getOnMayCloseMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@OnMayClose
. The method must
be public, non-static, have a return-type of void and take zero
parameters.classElement
- processingEnvironment
- GenerationException
public static String getOnCloseMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@OnClose
. The method must be
public, non-static, have a return-type of void and take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getOnShutdownMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@OnShutdown
. The method must be
public, non-static, have a return-type of void and take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getOnOpenMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@OnOpen
. The method must be
public, non-static, have a return-type of void and take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getOnLostFocusMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@OnLostFocus
. The method must
be public, non-static, have a return-type of void and take zero
parameters.classElement
- processingEnvironment
- GenerationException
public static String getOnFocusMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@OnFocus
. The method must be
public, non-static, have a return-type of void and take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getDefaultPositionMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@DefaultPosition
. The method
must be public, non-static, have a return-type of void and take zero
parameters.classElement
- processingEnvironment
- GenerationException
public static String getTitleMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@WorkbenchPartTitle
. The
method must be public, non-static, have a return-type of java.lang.String
and take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getContextIdMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
GenerationException
public static ExecutableElement getTitleWidgetMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@WorkbenchPartTitleDecoration
. The
method must be public, non-static, have a return-type of
com.google.gwt.user.client.ui.IsWidget and take zero parameters.classElement
- processingEnvironment
- GenerationException
public static ExecutableElement getWidgetMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@WorkbenchPartView
. The method
must be public, non-static, have a return-type of IsWidget and take zero
parameters.classElement
- processingEnvironment
- GenerationException
public static boolean getIsWidget(TypeElement classElement, ProcessingEnvironment processingEnvironment)
classElement
- processingEnvironment
- public static boolean getIsElement(TypeMirror type, ProcessingEnvironment processingEnvironment)
type
- processingEnvironment
- public static boolean hasPresenterInitMethod(TypeElement classElement, ProcessingEnvironment processingEnvironment, ExecutableElement getWidgetMethod)
public static String getPopupMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@WorkbenchPartView
. The method
must be public, non-static, have a return-type of PopupPanel and take
zero parameters.classElement
- processingEnvironment
- GenerationException
public static boolean getIsPopup(TypeElement classElement, ProcessingEnvironment processingEnvironment)
classElement
- processingEnvironment
- public static String getIsDirtyMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@IsDirty
. The method must be
public, non-static, have a return-type of void and take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getOnSaveMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@OnSave
. The method must be
public, non-static, have a return-type of void and take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getMenuBarMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@WorkbenchMenu
. The method
must be public, non-static, have a return-type of WorkbenchMenuBar and
take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getToolBarMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@WorkbenchToolBar
. The method
must be public, non-static, have a return-type of WorkbenchToolBar and
take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getPerspectiveMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
@Perspective
. The method must
be public, non-static, have a return-type of PerspectiveDefinition and
take zero parameters.classElement
- processingEnvironment
- GenerationException
public static String getSplashFilterMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
GenerationException
public static String getBodyHeightMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
GenerationException
public static String getInterceptMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) throws GenerationException
GenerationException
public static String getBeanActivatorClassName(TypeElement classElement, ProcessingEnvironment processingEnvironment)
public static String getOwningPerspectivePlaceRequest(TypeElement screenOrEditorClass, ProcessingEnvironment processingEnvironment) throws GenerationException
screenOrEditorClass
- a type annotated with either @WorkbenchScreen
or @WorkbenchEditor
. Not null.processingEnvironment
- the current annotation processing environment.GenerationException
- if the owningPerspective parameter is present, but points to something other than a
@WorkbenchPerspective
class.public static AnnotationMirror getAnnotation(Elements elementUtils, Element annotationTarget, String annotationName)
public static Name getQualifiedName(AnnotationMirror annotation)
public static Collection<String> extractValue(AnnotationValue value)
public static List<AnnotationMirror> extractAnnotationsFromAnnotation(Elements elementUtils, Element element, String annotationName, String paramName)
elementUtils
- the current Elements object from this round of annotation processing.element
- The element targeted by the containing annotation.annotationName
- The containing annotation's fully-qualified name.paramName
- The name of the parameter on the containing annotation. The parameter's type must be an array of annotations.public static String formatAssociatedResources(Collection<String> resourceTypes)
public static boolean debugLoggingEnabled()
public static String extractAnnotationStringValue(Elements elementUtils, AnnotationMirror annotation, CharSequence paramName)
public static AnnotationValue extractAnnotationPropertyValue(Elements elementUtils, AnnotationMirror annotation, CharSequence annotationProperty)
public static List<String> getAllQualifiersDeclarationFromType(TypeElement element)
element
- TypeElement
which will be scanned for qualifier annotations.Copyright © 2012–2018 JBoss by Red Hat. All rights reserved.