企業管理 > Windchill 匯出與匯入 > Import and Export Policies, Mapping Rules, and Conflict Messages > Java Mapping with the METHOD Element
  
Java Mapping with the METHOD Element
Mapping rules that reside in the <mappingRules> element of a user’s settings file can invoke Java programs. The METHOD element has the two sub-elements <tag> and <value>, and an additional required sub-element, <class>. The <tag> and <value> sub-elements identify the element in the XML source file for which Java programs will perform mapping. The sub-element <class> defines a name of Java class, which must have the method with the following specification:
static public String mapElement (String path, String tag, String
oldValue, IxbElement oldXmlFile) throws WTException;
This method is called to get the new value for the specified element of the source XML file. It returns the new value of the element as a return value, or it returns one of two special values:
wt.ixb.tuner.Tuner. S_IGNORE;

wt.ixb.tuner.Tuner. S_IGNORE_PARENT;
The S_IGNORE return value, like the IGNORE element, means that this element is excluded from the resulting XML file. The S_IGNORE_PARENT return value, like the IGNORE_PARENT element, means that the parent of this element is excluded from the result XML file.
The following example shows the syntax for applying Java programs to map the value of a number attribute. The example assumes the package wt.ixb and the class MapByJava:
<METHOD>
<tag> number</tag>
<value>*</value>
<class>wt.ixb.MapByJava</class>
<METHOD>