You are here: Community > Working With Source Code > Sharpen > Sharpen Command-Line Arguments

Sharpen Command-Line Arguments

Sharpen command-line arguments can be defined in an options file

<sharpen workspace="${target.dir}" resource="sharpened_examples/src">
   <args>
      <!-- Sharpen options are defined in a separate file -->
      <arg value="@sharpen-all-options" />
    </args>
 </sharpen>      

Here sharpen-all-options file contains all command-line options needed to convert current project. For an example of command-line options file see the previous topic.

Command-line arguments can also be specified directly in an ant script:

<sharpen workspace="${dir.sharpen}" resource="db4oj/core/src">
    <args>
        <arg value="-xmldoc"/>
        <arg file="config/sharpen/ApiOverlay.xml" />       
        <arg value="@sharpen-all-options" />
     </args>
 </sharpen>
        

The following table shows available command-line options, their meaning and example usage:

Argument

Usage

-pascalCase

Convert Java identifiers to Pascal case

-pascalCase+

Convert Java indentifiers and package names (namespaces) to Pascal case

-cp

Adds a new entry to classpath:

<arg value="-cp" />

<arg path="lib/db4o-7.2.37.10417-java5.jar" />

-srcFolder

Adds a new source folder for sharpening

-nativeTypeSystem

Map java classes to .NET classes with a similar functionality. For example: java.lang.Class - System.Type

-nativeInterfaces

Adds an "I" in front of the interface name

-organizeUsings

Adds "using" for the types used

-fullyQualify

Converts to a fully-qualified name:

-fullyQualify File

-namespaceMapping

Maps a java package name to a .NET namespace. For example:

-namespaceMapping com.db4o Db4objects.Db4o

-methodMapping

Maps a java method name to a .NET method (can be method in another class). For example:

-methodMapping java.util.Date.getTime Sharpen.Runtime.ToJavaMilliseconds

-typeMapping

Maps a java class to .NET type:

-typeMapping com.db4o.Db4o Db4objects.Db4o.Db4oFactory

-propertyMapping

Maps a java method to .NET property:

-propertyMapping com.db4odoc.structured.Car.getPilot Pilot

-runtimeTypeName

Name of the runtime class. The runtime class provides implementation for methods that don't have a direct mapping or that are simpler to map at the language level than at the sharpen level. For instance: String.substring, String.valueOf, Exception.printStackTrace, etc.

For a complete list of all the method that can be mapped to the runtime class see Configuration#runtimeMethod call hierarchy.

-header

Header comment to be added to all converted files.

-header config/copyright_comment.txt

-xmldoc

Specifies an xml-overlay file, which overrides javadoc documentation for specific classes:

-xmldoc config/sharpen/ApiOverlay.xml

-eventMapping Converts the methods to an event.
-eventAddMapping Marks the method as an event subscription method. Invocations to the method in the form <target>.method(<argument>) will be replaced by the c# event subscription idiom: <target> += <argument>
-conditionalCompilation

Add a condition when to translate the Java code

- -conditionalCompilation com.db4o.db4ounit.common.cs !SILVERLIGHT

-configurationClass Change the configuration class. The default is 'sharpen.core.DefaultConfiguration'