|
Extension SDK 9.0.5 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jdeveloper.audit.transform.Transform
A source code transform. Concrete subclasses of this class implement
single source transformations at one or more source locations. It is
sufficient for a subclass to implement only the method which
actually changes the source code, apply()
. HOwever, if a subclass
also overrides isApplicable()
and/or isApplied()
, the
framework can give better feedback to the user.
A single tranform instance can be applied in many source code contexts, so
a transform cannot be created with knowledge of a particular source context.
Before Audit invokes any methods of a transform, therefore, it must first
bind the transform to a source location. The implementing methods of
the transform access the source location through the getLocation()
and getConstruct()
methods. If a transform needs additional information
to configure itself, it can define additional bean properties and the
analyzers which create the violation can supply values for those properties
as parameters to the violation.
Localized label and strings are returned by this class using the Localizer
supplied to the constructor. See label()
.
Constructor Summary | |
protected |
Transform(java.lang.String name,
Localizer localizer)
Creates a transform. |
Method Summary | |
abstract void |
apply()
Applies this transform. |
java.lang.Object |
getConstruct()
Gets the construct to which the transform is bound. |
Location |
getLocation()
Gets the location to which the transform is bound. |
boolean |
isApplicable()
Gets whether applying this transform is likely to succeed. |
boolean |
isApplied()
Gets whether this transform appears to have been already applied (whether because apply was invoked or because another agent caused the same effect). |
java.lang.String |
label()
Gets the localized label text for this transform from its localizer using the key "transform." + name() + ".label" if not bound, and
"transform." + name() + ".bound.label" if bound. |
java.lang.String |
name()
Gets the unlocalized name of this transform. |
void |
setLocation(Location location)
Sets the location to which this transform is bound. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Transform(java.lang.String name, Localizer localizer)
name
- The unlocalized name of this transform.localizer
- The localizer which supplies localized strings for this
transform.Method Detail |
public java.lang.String name()
public void setLocation(Location location)
setLocation(null)
) this
transform.
public Location getLocation()
java.lang.IllegalStateException
- if this transform is not bound.public java.lang.Object getConstruct()
java.lang.IllegalStateException
- if this transform is not bound.public boolean isApplicable()
Transform
implementation returns
true. If a subclass can test for situations where apply is sure to fail,
it can override this method to make the test and return false if it fails.
Note that the Audit framework handles the case of unmodifiable documents.
java.lang.IllegalStateException
- if this transform is not bound.public abstract void apply()
isApplicable()
returns true and isApplied()
returns false.
java.lang.IllegalStateException
- if this transform is not bound.public boolean isApplied()
Transform
implementation returns false.
java.lang.IllegalStateException
- if this transform is not bound.public java.lang.String label()
"transform." + name() + ".label"
if not bound, and
"transform." + name() + ".bound.label"
if bound. This text
can refer to properties of this transform using the property name enclosed
in braces. For example, a concrete Transform named "rename-field" which has
name
and suggestedName
properties (populated
only when the transform is bound) might have the following in its resource
bundle:
transform.rename-field.label=Rename Field
transform.rename-field.bound.label=Rename field "{name}" to "{suggestedName}"
Localizer
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.